E
E
Endru2016-12-16 07:49:05
JavaScript
Endru, 2016-12-16 07:49:05

How to transfer Gulp to another project?

Help to deal with gallp. It seems that I already installed it, configured it, everything works, and now I want to transfer it to another project, so as not to install everything from scratch, I take the files gulpfile.js, package.json and transfer the directory structure to the folder with the new project. I enter , all packages are pulled up, everything seems to work, except for one. When changing a file in the directory, the page in the browser should be updated using browser-sync, everything works in the old project, not in the new one, although the files are the same with the source code. The terminal displays npm i

[BS] Reloading Browsers...
, but the reboot does not occur.
Maybe I'm transferring the project incorrectly?
I spend everything on one PC, in different directories. OS Windows 10.
Here is a piece of code:
gulp.task('browser-sync', function() { 
    browserSync({ 
        server: { 
            baseDir: 'app' 
        },
        notify: false 
    });
});

gulp.task('watch', ['browser-sync', 'css-libs', 'scripts'], function() {
    gulp.watch('app/sass/**/*.scss', ['sass']); 
    gulp.watch('app/*.html', browserSync.reload); 
    gulp.watch('app/js/**/*.js', browserSync.reload);   
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Yanyshev, 2016-12-16
@villiwalla

On Win10, the same problem was, after a dozen restarts of gulp tasks, it somehow understood what to do. On *unix this was not yet the case. Try

browserSync.init({ 
        server: { 
            baseDir: './app' 
        }

A
Alexander Belkevich, 2016-12-16
@AlexBelkevich

Is there a body tag in the HTML file? Faced with similar, it turns out stupidly he lacked this tag

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question