javascript - Rendering HTML using Gulp.js template compilers -
what easiest way use 1 of gulp template compilers render html files?
gulp.task('html', function () { gulp.src('templates/**/*') .pipe(handlebars()) .pipe(whatcangoheretorenderhtml()) .pipe(gulp.dest('www')); });
the simplest way found render templates directly html using gulp-consolidate plugin per following example:
var gulp = require('gulp'); var consolidate = require('gulp-consolidate'); gulp.task('html', function() { gulp.src('templates/**/*.html') .pipe(consolidate('handlebars', {msg:'this message!'})) .pipe(gulp.dest('www')); });
keep in mind handlebars library need installed example work.
Comments
Post a Comment