gulp-swig
gulp-swig copied to clipboard
Cache false option not working
Hi,
I am having issues with caching on gulp watch. This is how I have it set:
var swigOptions = {
load_json: true,
json_path: './data',
defaults: { cache: false },
data: JSON.parse(fs.readFileSync('./data/data.json')),
setup: function(swig) {
swig.setDefaults({
loader: swig.loaders.fs(__dirname + '/templates' ),
cache: false
});
}
};
//Template task
gulp.task('templates:site', function() {
gulp.src([
paths.src.templates + '/index.html',
paths.src.pages.site + '/*.html',
paths.src.pages.site + '/**/*.html'
])
.pipe(plumber())
.pipe(swig(swigOptions))
.pipe(gulp.dest(paths.frontend.root))
.on("end", reload);
});
// I have other tasks for compiling templates in other places of the project
gulp.task('templates', ['templates:site', 'templates:bdg', 'templates:sg']);
// this is how the watch task is set
gulp.task('watch', function() {
//... some other tasks
gulp.watch(paths.src.data + '/**/*.json', ['templates']);
gulp.watch(paths.src.templates + '/**/*.html', ['templates']);
});
Everything works when I run gulp or the templates tasks by itself, I get the update version of my json files, but not on watch.
You can see that I try to set cache to false in different alway, but with no luck.
I was using version 0.7.4, have updated to version 0.8 but nome of them seem to work with the cache set to false.
Thanks for looking into it ;)