BrowserSync with gulp and wamp not refreshing php files -
my gulp file:
var gulp = require('gulp'); var browsersync = require('browser-sync').create(); //server gulp.task('run', function() { browsersync.init({ proxy: "http://localhost/test-site/" }); gulp.watch("./*.php").on('change', browsersync.reload); });
when running gulp run
terminal it's fire browser , shows page expected without "connected browsersync" msg , when saving changes gulp watch fires , terminal shows [bs] reloading browsers...
browser not refreshing page
now on other hand when i'm changing file extension "html" , gulp watch gulp.watch("./*.html").on('change', browsersync.reload);
work expected: when running task it's fire browser, time "connected browsersync" msg , when saving changes refresh page. today did manage refresh page on php file change lost , can't find reason why it's not working more, couldn't find post on google ideas ?
create reload
, projectphpwatchfiles
objects
var projectphpwatchfiles = './**/*.php'; // path php files. var reload = browsersync.reload; // manual browser reload.
then in watch process, add this
gulp.watch( projectphpwatchfiles, reload); // reload on php file changes.
and start refreshing on changes. if use wordpres, have handy repo wpgulp takes care of this.
Comments
Post a Comment