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
'use strict';require('dotenv').config;constgulp=require('gulp');constbrowserSync=require('browser-sync');constnodemon=require('gulp-nodemon');constsassify=require('gulp-sass');constprefix=require('gulp-autoprefixer');constminify=require('gulp-minify-css');constuglify=require('gulp-uglify');constconcat=require('gulp-concat');constutil=require('gulp-util');constrename=require('gulp-rename');// we'd need a slight delay to reload browsers// connected to browser-sync after restarting nodemonletBROWSER_SYNC_RELOAD_DELAY=1000;letDEV_MODE=process.env.DEV_MODEgulp.task('nodemon',function(cb){letcalled=false;returnnodemon({// nodemon our expressjs serverscript: 'app.js',// watch core server file(s) that require server restart on changewatch: ['app.js']}).on('start',functiononStart(){// ensure start only got called onceif(!called){cb();}called=true;}).on('restart',functiononRestart(){// reload connected browsers after a slight delaysetTimeout(functionreload(){browserSync.reload({stream: false});},BROWSER_SYNC_RELOAD_DELAY);});});gulp.task('browser-sync',['nodemon'],function(){// for more browser-sync config options: http://www.browsersync.io/docs/options/browserSync.init({// informs browser-sync to proxy our expressjs app which would run at the following locationproxy: 'http://localhost:8000',// informs browser-sync to use the following port for the proxied appport: 8080,});});// gulp.task('js', function () {// return gulp.src('public/**/*.js')// // do stuff to JavaScript files// //.pipe(uglify())// //.pipe(gulp.dest('...'));// });gulp.task('sass',function(){returngulp.src('public/sass/**/*.sass').pipe(sassify()).pipe(prefix('last 10 version')).pipe(DEV_MODE ? minify() : util.noop()).pipe(rename(function(path){path.extname='.min.css';})).pipe(gulp.dest('public/css')).pipe(browserSync.reload({stream: true}))});gulp.task('vendor-css',function(){returngulp.src('vendor/css/**/*.css').pipe(minify()).pipe(concat('vendor.min.css')).pipe(gulp.dest('public/css')).pipe(browserSync.reload({stream: true}))});// gulp.task('css', function () {// return gulp.src('public/css/**/*.css')// .pipe(browserSync.reload({ stream: true }));// })gulp.task('bs-reload',function(){browserSync.reload();});gulp.task('default',['vendor-css','sass','browser-sync'],function(){//gulp.watch('public/**/*.js', ['js', browserSync.reload]);gulp.watch('vendor/css/**/*.css',['vendor-css']);gulp.watch('public/sass/**/*.sass',['sass']);gulp.watch('app/views/**/*.pug',['bs-reload']);});
The text was updated successfully, but these errors were encountered:
Kind of same problem with me, trying to figure out a way to have app.js as start point for browsersync (by modifying bs-config) However no luck with it.
Browser not reloading when saving app.js???
The text was updated successfully, but these errors were encountered: