Good afternoon, I ask for help. The second day I can not cope with the complexity.

I plan to make a watch task to track file changes and in parallel make tasks synchronous using a run-sequence. I wrote the watch task in the gulpfile, when you call it, everything is fine, but as soon as I change the file, an error is generated, the file code and errors below.

var gulp = require('gulp'); var clean = require('gulp-clean'); var nunjucksRender = require('gulp-nunjucks-render'); var prettify = require('gulp-prettify'); var scss = require('gulp-sass'); var autoprefixer = require('gulp-autoprefixer'); var plumber = require('gulp-plumber'); var gutil = require('gulp-util'); var watch = require('gulp-watch'); var runSequence = require('run-sequence').use(gulp); var cached = require('gulp-cached'); var merge = require('merge-stream'); var buffer = require('vinyl-buffer'); var browserSync = require('browser-sync'); var errorHandler = function(error){ gutil.log([ '\n', 'Error plugin:', error.plugin, '\n', 'Error massage:', error.message, '' ].join('\n')); }; gulp.task('clean', function(){ return gulp .src('./build') .pipe(clean()); }); gulp.task('html', function() { return gulp .src(['./source/*.html', './source/pages/*.*']) .pipe(cached('html')) .pipe(plumber( errorHandler )) .pipe(nunjucksRender({ path: './source/pages/includes' })) .pipe(prettify({ indent_size: 2 })) .pipe(gulp.dest(function(file){ return file.basename != 'index.html' ? './build/pages' : './build'; })); }); gulp.task('scss', function() { return gulp .src('./source/scss/style.scss') .pipe(cached('style')) .pipe(plumber( errorHandler )) .pipe(scss.sync()) .pipe(autoprefixer({ browsers: ['last 2 versions'], cascade: false })) .pipe(gulp.dest('./build/css')); }); gulp.task('watch', function(){ global.watch = true; watch('./source/scss/**/*.*', function(){ runSequence('scss'); }); }); 

Error code:

 [10:09:16] Starting 'watch'... (node:6324) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: gulp.hasTask is not a function 

Versions:

 CLI version 1.2.2 Gulp: Local version 4.0.0-alpha.2 run-sequence: 1.2.2, 
  • .pipe (gulp.dest ('./ build / css')); remove semicolons, do not create a bunch of var, all separated by a comma so beautiful and .src ('./ source / scss / style.scss') points .src ('/ source / scss / style.scss') - Lieutenant Jim Dangle
  • @LieutenantJimDangle, it tastes and color. Semicolon - good tone. A lot of var visually (to me personally). - Artem Gorlachev
  • @LieutenantJimDangle, I will try, I will look. - Version8

1 answer 1

Error in run-sequence - they promise to support gulp 4. * when it comes out of beta.

issue

  • thank. nothing but tormented ( - Version8
  • @ Version8, Put 3 gulp, demay will work if no one else needs 4 gulp - Artem Gorlachev