1.0.6 • Published 9 years ago

gulp-handlebars-robot v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Usage

Install gulp-handlebars-robot as a development dependency:

npm install --save-dev gulp-handlebars-robot

Compiling templates

Given the following directory structure:

src                          # Your application's source files
-- tpl
    |-- hbs                  # A folder containing templates named with dot notation
    |   |-- app
    |   |   `-- detail.hbs
    |   `-- index.hbs
    |-- json                 # A folder containing json data for templates
    |   |-- app
    |   |   `-- detail.json
    |   `-- index.json       # json for index.hbs, allow not existed
    `-- layout
        `-- main-layout.hbs # layout file for handlebars-layouts

gulpfile.js

gulp.task('tpl', ['clean-tpl'], function() {
  return gulp.src('./src/tpl/hbs/**/*')
    .pipe(handlebars_robot({
      root: './src/tpl/', //the root that contain json directory and layout directory
      ext: '.html' //output file extention
    }))
    .pipe(gulp.dest('./build/tpl/'));
});