1.0.0 • Published 10 years ago
gulp-underscore-tpl v1.0.0
Install
npm install gulp-underscore-tpl --saveOptions
options see underscore template.
How to use
var template = require('gulp-underscore-tpl')
gulp.task('tpl', function() {
return gulp.src('tpl/*.html')
.pipe(template(/*options*/))
.pipe(gulp.dest('js/tpl'))
});Input
tpl.html
<h1><%= name%></h1>Output
tpl.js
module.exports = function(data){
var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};
__p+='<h1>'+
((__t=( name))==null?'':__t)+
'</h1>';
return __p;
};LICENSE
1.0.0
10 years ago