Closed elisechant closed 9 years ago
Oh, good call. gulp-hb
uses require-glob
and handlebars-registrar
behind the scenes. Fortunately I also own those modules. I'll need to add an option to require-glob
to allow forcing a reload, then pass the option through from here.
I'll add a reload
boolean option to this plugin.
I have been successfully using https://www.npmjs.com/package/require-new in similar situations, might be an option.
I've added bustCache
and debug
options and released them as v2.4.0. See README.md for details.
Thanks! Was just trying to work around this yesterday...
@shannonmoeller awesome stuff, confirming bustCache works as expected. And liking the debug flag.
@elisechant Thanks for confirming!
Interesting, I just came across a similiar issue:
function compileHandlebars() {
return gulp
.src('./*.html')
.pipe(
hb({ debug: true, bustCache: true })
.partials('./src/components/threesixty/threesixty.hbs')
.helpers({
JSONString: object => JSON.stringify(object),
})
.data({ assetPath: `/${paths.assets}` })
.data(handlebarData),
)
.pipe(gulp.dest(path.resolve(__dirname, paths.tmp)));
}
gulp.watch(
[`./${paths.src}/**/*.hbs`, './*.html', `./${paths.src}/**/*.json`],
gulp.series(compileHandlebars, js, reload),
);
Changing something in my html file works fine. But when changing the threesixty.hbs partial the changes are not visible until I edit the html file or restart gulp.
I'm using gulp 4 and gulp-hb 8 Any ideas?
@jensbambauer That’s odd. I’d expect that to work fine based on your setup. Mind opening a new issue for this?
Sure, I will open a new issue. My workaround now is to have a watcher for the hbs files which just update the html file date :)
With the following gulp-hb configuration:
And the following watch task:
Although this watch task triggers the 'templates' task to rerun on all template file changes, only changes to Handlebars Templates (.html) update and never Handlebars Partials. Handlebars Partials appear to become cached by gulp-hb. Is it possible to force the partials to update or could this be a bug?