gulp-tmpl

0.0.3 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i gulp-tmpl

Weekly Downloads

1

Version

0.0.3

License

MIT

Last publish

Collaborators

  • adrianolaru