gulp-tmpl

Lodash/Underscore templates plugin for gulp.

gulp-tmpl

Lodash/Underscore templates plugin for gulp 3

First, install gulp-tmpl as a development dependency:

npm install --save-dev gulp-tmpl

gulp-declare can be used to compile templates for the browser. Just pipe the output of gulp-tmpl to gulp-declare:

var template = require('gulp-tmpl');
var declare = require('gulp-declare');
 
gulp.task('templates', function(){
  gulp.src(['client/templates/*.hbs'])
    .pipe(template())
    .pipe(declare({
      namespace: 'MyApp.templates'
    }))
    .pipe(concat('templates.js'))
    .pipe(gulp.dest('build/js/'));
});

Type: Object

Compiler options to pass to _.template.

All the credit goes too Larry Davis. This plugin is heavily inspired (read copy) from his gulp-handlebars plugin.