Skip to content

🔧 create a compiled ejs file with window.JST exposed

License

Notifications You must be signed in to change notification settings

CloudCannon/gulp-ejs-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@cloudcannon/gulp-ejs-template

🔧 create a compiled ejs file with window.JST exposed. Uses underscore's template function to match the rails pipeline.

ejs template plugin for gulp

Usage

Install @cloudcannon/gulp-ejs-template as a development dependency:

npm install --save-dev @cloudcannon/gulp-ejs-template

Then, add it to your gulpfile.js:

var ejs = require("@cloudcannon/gulp-ejs-template")
var concat = require("gulp-concat");
var rename = require("gulp-rename");
var gap = require("gulp-append-prepend");

gulp.task("ejs", function () {
	return gulp.src("templates/**/*.jst.ejs")
		.pipe(ejs())
		.pipe(rename(function (path) {
			path.extname = ".js";
		}))
		.pipe(concat(".jst-cache.js"))
		.pipe(gap.prependText("window.JST = window.JST || {};"))
		.pipe(gulp.dest("app/assets/javascripts/"));
});

License

MIT License

About

🔧 create a compiled ejs file with window.JST exposed

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published