var gulp = require('gulp'),
browserSync = require('browser-sync').create(),
less = require('gulp-less'),
sass = require('gulp-sass');
gulp.task('server', gulp.series('less'), function() {
browserSync.init({
server: {
baseDir: "./app/"
}
});
gulp.watch('./app/**/*.html').on('change', browserSync.reload);
gulp.watch('app/less/**/*.less', gulp.series('less'));
});
gulp.task('less', function(){
return gulp.src('./app/less/main.less')
.pipe(less())
.pipe(gulp.dest('./app/css'))
.pipe(browserSync.stream());
});
gulp.task('default', gulp.series('server'));
Ошибки в консоли:
C:\Users\Bunny\Desktop\hotel>gulp
assert.js:374
throw err;
^
AssertionError [ERR_ASSERTION]: Task never defined: less
at getFunction (C:\Users\Bunny\Desktop\hotel\node_modules\←[4mundertaker←[24m\lib\helpers\normalizeArgs.js:15:5)
at map (C:\Users\Bunny\Desktop\hotel\node_modules\←[4marr-map←[24m\index.js:20:14)
at normalizeArgs (C:\Users\Bunny\Desktop\hotel\node_modules\←[4mundertaker←[24m\lib\helpers\normalizeArgs.js:22:10)
at Gulp.series (C:\Users\Bunny\Desktop\hotel\node_modules\←[4mundertaker←[24m\lib\series.js:13:14)
at Object.<anonymous> (C:\Users\Bunny\Desktop\hotel\gulpfile.js:7:26)
←[90m at Module._compile (internal/modules/cjs/loader.js:959:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:815:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:727:14)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:852:19)←[39m {
generatedMessage: ←[33mfalse←[39m,
code: ←[32m'ERR_ASSERTION'←[39m,
actual: ←[90mundefined←[39m,
expected: ←[33mtrue←[39m,
operator: ←[32m'=='←[39m
}