Answer the question
In order to leave comments, you need to log in
Why are changes not pulled to the page after refreshing the page with browser-sync?
Hello.
When I make changes to twig (html) files and save them, the page refreshes but the changes are not pulled.
This happens in chrome, if you take firefox then everything works as it should.
const projectFolder = 'dist';
const sourceFolder = 'src';
let path = {
build: {
twig: projectFolder + '/',
},
src: {
twig: [sourceFolder + '/twig/*.twig'],
},
watch: {
twig: sourceFolder + '/twig/**/*.twig',
},
clean: './' + projectFolder + '/',
};
function browserSync() {
browsersync.init({
server: {
baseDir: './' + projectFolder + '/',
},
port: 3000,
notify: false,
});
}
function watchFiles() {
gulp.watch([path.watch.twig], html);
}
function clean() {
return del(path.clean);
}
function html() {
return src(path.src.twig)
.pipe(
twig()
)
.pipe(dest(path.build.twig))
.pipe(browsersync.stream());
}
const build = gulp.series(clean, gulp.parallel(html));
const watch = gulp.series(build, gulp.parallel(browserSync, watchFiles));
exports.html = html;
exports.build = build;
exports.watch = watch;
Answer the question
In order to leave comments, you need to log in
const watch = gulp.parallel(build, watchFiles, browserSync);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question