Skip to content

server restarts on change in logs/ #22

@thatkookooguy

Description

@thatkookooguy

My folder structure is:

<app_name>
  logs/
  server/
  public/
  server.js
  gulpfile.js
  bower.json
  package.json

And my gulp file is setup as follows:

var FILES = {};
FILES.FRONTEND_JS = ['./public/app/**/*.js'];
FILES.FRONTEND_HTML = ['./public/app/**/*.html'];
FILES.FRONTEND_SASS = ['./public/assets/sass/**/*.scss'];
FILES.FRONTEND_ALL = [].concat(FILES.FRONTEND_JS, FILES.FRONTEND_HTML, FILES.FRONTEND_SASS);
FILES.SERVER_JS = ['./server/**/*.js', './server.js', './config.js'];
FILES.BUILD_FILES = ['./gulpfile.js'];
FILES.JS_ALL = [].concat(FILES.FRONTEND_JS, FILES.SERVER_JS);

gulp.task('watch', [ 'serve' ], function() {
    function restart( file ) {
        server.changed( function( error ) {
            if( ! error ) {
                reloadBrowser('Backend file changed.', file.path);
            }
        });
    }

    function reloadBrowser( message, path ) {
        gutil.log(message ? message : 'Something changed.', gutil.colors.bgBlue.white.bold('Reloading browser...'));
        livereload.changed( path );
    }

    gulp.watch(FILES.JS_ALL, ['lint-js']);
    gulp.watch(FILES.FRONTEND_SASS, ['styles']);
    gulp.watch(FILES.SERVER_JS).on( 'change', restart );
    gulp.watch(FILES.FRONTEND_ALL).on( 'change', function(file) {reloadBrowser('Frontend file changed.', file.path);} );
});

Even though non of the gulp.watch calls that I do should reload (by liveReload which is managed by gulp-develop-server) since the logs/ folder isn't present in those paths, I get the following reload:

[21:12:55] Development server was stopped. (PID:6600)
[21:12:55] Development server already received restart requests.
[21:12:55] Backend file changed. Reloading browser...
[21:12:55] ...\<app_name>\logs reloaded.

why should it reload on any change in logs/?

I'm currently testing this on a windows 10 machine. I'll check if the same happens on ubuntu and os x.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions