Compile Lo-Dash templates (should work with Underscore templates too).
This is a fork of [https://github.com/ingro/gulp-template-compile].
The major difference is the removal of the namespace functionality for replacement with a simple object assignment. This allows the output code to be wrapped in a closure where no namespacing is required.
var gulp = require('gulp');
var template = require('gulp-template-compile');
var concat = require('gulp-concat');
gulp.task('default', function () {
gulp.src('src/*.html')
.pipe(template())
.pipe(concat('templates.js'))
.pipe(gulp.dest('dist'));
});
See the Lo-Dash _.template
docs.
Type: Object
Type: Function
Default: Relative template path. Example: templates/list.html
You can override the default behavior by supplying a function which gets the current File object and is expected to return the name.
Example:
{
name: function (file) {
return 'tpl-' + file.relative;
}
}
Type: String
Default: 'templates'
The object to which the precompiled templates will be assigned.
Type: Object
Default: null
Type: 'Boolean' Default: null
Wrap each precompiled template with an IIFE. If you don't need it simply set this option to false
.
MIT