gulp-jstemplater

0.0.3 • Public • Published

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: "..."
    }
}

Package Sidebar

Install

npm i gulp-jstemplater

Weekly Downloads

0

Version

0.0.3

License

ISC

Last publish

Collaborators

  • maxmert