Skip to content

Instantly share code, notes, and snippets.

@alexey-sh
Created February 14, 2015 23:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexey-sh/cff195650274c6e021a1 to your computer and use it in GitHub Desktop.
Save alexey-sh/cff195650274c6e021a1 to your computer and use it in GitHub Desktop.
gulp ejs precompile
var ejs = require('gulp-ejs-precompiler');
var concat = require('gulp-concat');
var gulp = require('gulp');
var insert = require('gulp-insert');
gulp.task('default', function() {
return gulp.src("./app/templates/*.ejs")
.pipe(ejs({
compileDebug: true,
client: true
}))
.pipe(concat('templates.js'))
.pipe(insert.wrap('define("templates", [], function () { var templates = {};'+"\n", "return templates;\n});"))
.pipe(gulp.dest("./app/templates"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment