Wednesday, 12 April 2017

NPM Build Script - Broswer-Sync

I'm currently trying to move away from Gulp to NPM Scripts but having trouble replicating my brower-sync setup which currently looks like this:

gulp.task('serve', function () {
    browserSync.init({
        proxy: 'localhost:59115',
        port: 59115
    });

    gulp.watch('wwwroot', function (file) {
        browserSync.reload(file.path);
    });
});

I have this so far:

 "serve": "browser-sync start --proxy localhost:59115/index.html --port 59115 --files wwwroot"

but rather than injecting the changed file like my gulp method does, the '--files wwwroot' part just reloads the whole page every time a file changes.

How do I inject specific file changes rather than reload the whole browser using the command line browser-sync syntax?



via user2568972

No comments:

Post a Comment