0.0.3 • Published 10 years ago

gulp-tmpl v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
10 years ago

gulp-tmpl

Lodash/Underscore templates plugin for gulp 3

Usage

First, install gulp-tmpl as a development dependency:

npm install --save-dev gulp-tmpl

Compiling to a namespace for the browser

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/'));
});

API

template(options)

options.compilerOptions

Type: Object

Compiler options to pass to _.template.

Credit

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