Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watching new files #99

Open
Plou opened this issue Apr 25, 2017 · 0 comments
Open

Watching new files #99

Plou opened this issue Apr 25, 2017 · 0 comments

Comments

@Plou
Copy link
Member

Plou commented Apr 25, 2017

The easy way is to upgrade to gulp 4:

# global
npm upgrade -g gulp-cli

# local (each project)
npm uninstall gulp --save-dev
 npm install 'gulpjs/gulp.git#4.0' --save-dev

The task and watch system changes a bit, so the upgraded gulpfile.js looks like that:

// gulpfile.js
[...]

gulp.task('serve', function() {

    browserSync.init({
        server: "./",
        open: false,
    })
    let watcher = {
      scss : gulp.watch('css/src/**/*.scss'),
      js : gulp.watch('js/src/**/*.js'),
      pug : gulp.watch('templates/**/*.pug'),
      img : gulp.watch('img/**/*')
    }

    watcher.scss.on('all', gulp.parallel('scss'))
    watcher.js.on('all', gulp.parallel('js'))
    watcher.pug.on('all', gulp.parallel('pug'))
    watcher.img.on('all', gulp.parallel(browserSync.reload))


    gulp.parallel('scss')
})

gulp.task('build', gulp.parallel('pug', 'scss', 'js'))
gulp.task('default', gulp.parallel('build', 'serve'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant