gulp-jstemplater
v0.0.3
Published
Compiles all templates into one js variable.
Downloads
3
Maintainers
Readme
gulp-jstemplater
Compiles all templates into one json. Tested with mustache (should work with every mustache-like templates).
Example
Compile all templates at path/**/*.html
into file templates.js
and put it to destpath
.
gulp.task 'templates', ->
gulp.src( [ "path/**/*.html" ] )
.pipe( templater( "templates.js", {variable: "TMPL"} ) )
.pipe( gulp.dest "path-to-compiled-file" )
If you have files
/path/layout.html
/path/widgets/newone.html
/path/widgets/old.html
/path/widgets/sidebar/left.html
/path/footer/bottom.html
then it will compile to templates.js
:
TMPL = {
layout: "...",
widgets: {
newone: "...",
old: "...",
sidebar: {
left: "..."
}
},
footer: {
bottom: "..."
}
};
Options
variable
Name of the variable. If it not provided, then jstemplater will compile to
{
layout: "...",
widgets: {
newone: "...",
old: "...",
sidebar: {
left: "..."
}
},
footer: {
bottom: "..."
}
}