Shift is a static site generator for Handlebars. It is, in essence, a simple wrapper for a handful of underlying libraries which allows for easy compilation of Handlebars templates into static HTML files using Gulp.
npm install --save-dev mosaic-shift
var gulp = require("gulp");
var shift = require("mosaic-shift");
// Compile all the handlebars templates in the `source` folder.
gulp.task("build", function() {
return gulp.src("source/**/*.hbs")
.pipe(shift())
.pipe(gulp.dest("public"));
});
An example build which uses handlebars-layouts can be found in this repository:
Data can be gathered and used inside of your Handlebars templates in a variety of ways. Unless otherwise noted, the
gathered data will be available on the data
property of the file
object as specified in
gulp-data.
- Front Matter defined at the top of the template.
- JSON companion files which live next to your template files.
- Data files from anywhere inside the current working directory. This data will be available in the root template context with in a structure mirroring the directory and file names of the given files.
A navigation tree will be created automatically for all the files found within
the given gulp.src
directory and attached to the file.data
property as file.data.nav
.
Template compilation is handled by gulp-hb, which provides options for registering custom Handlebars helpers and partials.
Output will be piped to the given gulp.dest
directory and prettified with
gulp-htmltidy.
MIT