Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: missing partial: 'html/template' #47

Open
paceaux opened this issue Jan 22, 2020 · 0 comments
Open

Error: missing partial: 'html/template' #47

paceaux opened this issue Jan 22, 2020 · 0 comments

Comments

@paceaux
Copy link

paceaux commented Jan 22, 2020

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant