gulp-mustacher
v0.1.17
Published
Build HTML static pages. Perfect for templating eZPublish, Magento, Drupal... CMS models
Downloads
11
Maintainers
Readme
gulp-mustacher
Gulp task build over Mustacher module
Designed for fit my own needs to build HTML static pages. Perfect for templating eZPublish, Magento, Drupal... CMS models
It provide an easy way to include handlebar's partials files inside HTML template page with a minimal list of helpers like repeat (loop), or, and.
Exposed HTML/Handlebar's helpers
blocks helpers
inline helpers
Install
npm install gulp-mustacher --save-dev
Usage
gulpfile.js
var gulp = require('gulp'),
path = require('path'),
mustacher = require('gulp-mustacher');
gulp.task('default', function () {
var options = {
partials: {
ext: '.hbs',
src: 'src/html/partials'
}
};
return gulp.src(path.join('src', '*.tpl'))
.pipe(mustacher(options))
.pipe(gulp.dest('build/html'));
});
src/html/index.tpl
<!DOCTYPE html>
<html lang="fr">
<head>
....
<!-- include dist/css/bundle.css in a <link href="... -->
{{$css 'css/bundle'}}
<!--
or include inline styles from a file
{{$css 'dist/public/css/bundle' true}}
-->
</head>
<body>
<div id="before-body">
...
</div>
<!-- include src/html/partials/header.hbs -->
{{$include 'header'}}
<div id="main">
<!-- include src/html/partials/contents/main.hbs -->
{{$include 'contents/main'}}
</div>
<!-- include src/html/partials/footer.hbs -->
{{$include 'footer'}}
<div id="after-body">
...
</div>
</body>
</html>
More Documentation & Examples
Issues
not yet implemented
- Lorem Ipsum