Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const browsersync = require("browser-sync");
- const gulp = require("gulp");
- const phpConnect = require('gulp-connect-php');
- // PHP connect
- function connectsync() {
- phpConnect.server({
- // a standalone PHP server that browsersync connects to via proxy
- port: 8000,
- keepalive: true,
- base: "dist"
- },
- function () {
- browsersync({
- proxy: '127.0.0.1:8000'
- });
- });
- }
- // BrowserSync Reload
- function browserSyncReload(done) {
- browsersync.reload();
- done();
- }
- function php() {
- return gulp.src("./public_html/**/*.php")
- .pipe(gulp.dest("./dist"));
- }
- // Watch files
- function watchFiles() {
- gulp.watch("public_html/**/*.php", gulp.series(php, browserSyncReload));
- }
- const watch = gulp.parallel([watchFiles, connectsync]);
- exports.default = watch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement