$ gulp
[19:40:23] Using gulpfile E:\WM\LP-ITVDN\gulpfile.js
[19:40:23] Starting 'default'...
[19:40:23] Starting 'clean'...
[19:40:23] Finished 'clean' after 7.78 ms
[19:40:23] Starting 'views'...
[19:40:23] Starting 'styles:compile'...
[19:40:23] Starting 'sprite'...
[19:40:23] Starting 'copy'...
[19:40:23] Starting 'copy:fonts'...
[19:40:23] Starting 'copy:images'...
[19:40:23] Finished 'copy:fonts' after 34 ms
[19:40:23] Finished 'copy:images' after 36 ms
[19:40:23] Finished 'copy' after 71 ms
[19:40:23] Finished 'views' after 141 ms
[19:40:23] Finished 'styles:compile' after 142 ms
[19:40:23] The following tasks did not complete: default, <parallel>, sprite
[19:40:23] Did you forget to signal async completion?
вот gulpfile.js
var gulp = require('gulp'),
browserSync = require('browser-sync'),
pug = require('gulp-pug'),
sass = require('gulp-sass'),
spritesmith = require('gulp.spritesmith'),
rimraf = require('rimraf');
// Static server
gulp.task('server', function() {
browserSync.init({
server: {
port: 9000,
baseDir: "build"
}
});
gulp.watch('build/**/*').on('change', browserSync.reload);
});
// GULP PUG
gulp.task('views', function buildHTML() {
return gulp.src('source/template/index.pug')
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('build'))
});
// GULP SASS
gulp.task('styles:compile', function () {
return gulp.src('source/styles/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('.build/css'));
});
// GULP SPRITE
gulp.task('sprite', function () {
var spriteData = gulp.src('source/images/icons/*.png').pipe(spritesmith({
imgName: 'sprite.png',
imgPath: '../images/sprite.png',
cssName: 'sprite.css'
}));
spriteData.pipe(gulp.dest('build/images/'));
spriteData.pipe(gulp.dest('source/styles/global/'));
});
//GULP RIMRAF
gulp.task('clean', function del(cb) {
return rimraf('build', cb);
});
//COPY FONTS
gulp.task('copy:fonts', function() {
return gulp.src('./source/fonts/**/*.*')
.pipe(gulp.dest('build/fonts'));
});
//COPY IMG
gulp.task('copy:images', function() {
return gulp.src('./source/images/**/*.*')
.pipe(gulp.dest('build/images'));
});
//COPY IMG+FONTS
gulp.task('copy', gulp.parallel('copy:fonts', 'copy:images')); //gulp.parallel - only gulp v.4
//GULP WATCH
gulp.task('watch', function() {
gulp.watch('source/template/**/*.pug', gulp.series('views'));
gulp.watch('source/styles/**/*.scss', gulp.series('styles:compile'));
});
//GULP DEFAULT
gulp.task('default', gulp.series(
'clean',
gulp.parallel('views', 'styles:compile', 'sprite', 'copy'),
gulp.parallel('watch', 'server')
)
);