You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this is my gulp code. restart event never fires even when I change the server.js file. If I remove the start event then restart event fires up. I want to reload browser when any changes are made in server.js file. Please help me to find out what's wrong.
constgulp=require('gulp');constbrowserSync=require('browser-sync');constnodemon=require('gulp-nodemon');// we'd need a slight delay to reload browsers// connected to browser-sync after restarting nodemonconstBROWSER_SYNC_RELOAD_DELAY=500;gulp.task('browser-sync',['nodemon'],()=>{browserSync({// informs browser-sync to proxy our expressjs app which would run at the following locationproxy: 'http://localhost:8080',// informs browser-sync to use the following port for the proxied appport: 8000,// open the proxied app in chromebrowser: ['firefox']});});gulp.task('nodemon',cb=>{conststarted=false;returnnodemon({script: 'server.js',env: {'NODE_ENV': 'development'}}).on('start',(event)=>{// to avoid nodemon being started multiple timesif(!started){cb();started=true;}}).on(`restart`,()=>{console.log(`App restarted!`)});});gulp.task('js',()=>{returngulp.src('src/**/*.js')});gulp.task('css',()=>{returngulp.src('src/**/*.css').pipe(browserSync.reload({stream: true}));})gulp.task('bs-reload',()=>{browserSync.reload();});gulp.task('copy-html-css',()=>{returngulp.src(["src/**/*.css","src/**/*.html"],{base: "src/."}).pipe(gulp.dest("dist"));});gulp.task('default',['browser-sync'],()=>{gulp.watch('src/**/*.js',['js',browserSync.reload]);gulp.watch('src/**/*.css',['css']);gulp.watch('src/**/*.html',['bs-reload']);});
The text was updated successfully, but these errors were encountered:
Hi, this is my gulp code.
restart
event never fires even when I change the server.js file. If I remove the start event then restart event fires up. I want to reload browser when any changes are made in server.js file. Please help me to find out what's wrong.The text was updated successfully, but these errors were encountered: