N
N
Neuro2018-07-14 10:00:07
JavaScript
Neuro, 2018-07-14 10:00:07

How to configure browser-sync to work with js files?

I want to set up a browsersunk to automatically refresh the page after a change in js files, but the default settings do not provide it for a watcher for js files, as soon as I did not try to change the task (gulp.watch("*.oy").on("change", reload) ;), nothing works, maybe someone has an example of use?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Egorov, 2018-07-14
@Riveran

Here:

gulp.task('browser-sync', function() {
    browserSync({
        server: { 
            baseDir: 'dev/client'
        },
        notify: false
    });
});

gulp.task('watch', ['browser-sync',], function() {
    gulp.watch('ваш_путь/**/*.js', browserSync.reload);
});

D
dsmaslov, 2018-07-14
@dsmaslov

https://browsersync.io/docs/gulp#gulp-reload

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question