handlebars-layouts
handlebars-layouts copied to clipboard
Error: missing partial: 'html/template'
I have been struggling quite a bit with generating a static site using gulp, handlebars, and handlebars layouts. I suspect I am doing something wrong but I cannot for the life of me figure out what it is. I am not sure if I am applying/ identifying a layout file correctly. Should it be as a partial?
I am using the following:
- gulp 4.0.2
- gulp hb 8.0.0 -handlebars-layouts 3.1.4
This is in my gulp file:
const { src, dest } = require('gulp');
const GulpHb = require('gulp-hb');
const {handlebars: config } = require('../config');
function getHbStream(config) {
return GulpHb({ debug: true })
.helpers(require('handlebars-layouts'))
.partials(config.partials)
.partials(config.layouts)
.helpers({...config.helpers})
.data(config.data);
}
function buildHandlebars() {
const hbStream = getHbStream(config);
return src(config.src)
.pipe(hbStream)
.pipe(dest(config.dest));
}
module.exports = buildHandlebars;
the configuration information looks like this:
handlebars: {
watch: path.join(sourceDir, sourceDirs.templates, '**/*.hbs'),
src: path.join(sourceDir,sourceDirs.templates,'*.hbs' ),
layouts: path.join(sourceDir,sourceDirs.templates,'layouts/*.hbs' ),
dest: buildDir,
data: path.join(sourceDir, 'data', '*.json'),
partials: path.join(sourceDir, sourceDirs.templates, 'partials', '**/*.hbs'),
helpers: {
'equal': function handlebarsEqualHelper(name, value, options) {
return this.context[name] === value ? options.fn(this) : options.inverse(this);
},
'set': function _handlebarsVariablesHelper(name, options) {
const content = options.fn(this);
this.context[name] = content;
},
},
},
What is the correct value for a layout partial? In none of my handlebars files do I have an 'html/template' partial. I'm assuming this is an internal of handlebars-layouts.
Stack error:
Error: Missing partial: 'html/template'
at Object.extend (\node_modules\handlebars-layouts\index.js:120:11)
at Object.eval [as main] (eval at createFunctionContext (\node_modules\handlebars\dist\cjs\handlebars\compiler\javascript-compiler.js:266:23), <anonymous>:5:96)
at main (node_modules\handlebars\dist\cjs\handlebars\runtime.js:176:32)