При запуске task build в gulp возникает ошибка:
The following tasks did not complete: build, style
Did you forget to signal async completion?
Версия gulp :
gulp -v
CLI version: 2.2.0
Local version: 4.0.2
Содержание gulpfile.js :
var gulp = require("gulp");
var less = require("gulp-less");
var plumber = require("gulp-plumber");
var postcss = require("gulp-postcss");
var posthtml = require("gulp-posthtml");
var include = require("posthtml-include");
var autoprefixer = require("autoprefixer");
var minify = require("gulp-csso");
var imagemin = require("gulp-imagemin");
var webp = require("gulp-webp");
var svgstore = require("gulp-svgstore");
var rename = require("gulp-rename");
var server = require("browser-sync").create();
var run = require("run-sequence");
var del = require("del");
gulp.task("style", function() {
gulp.src("source/less/style.less")
.pipe(plumber())
.pipe(less())
.pipe(postcss([
autoprefixer()
]))
.pipe(gulp.dest("build/css"))
.pipe(minify())
.pipe(rename("style.min.css"))
.pipe(gulp.dest("build/css"))
.pipe(server.stream());
});
gulp.task("sprite", function () {
return gulp.src("source/img/icon-*.svg") //Пишем названия файлов, который нужно поместить в спрайт
.pipe(svgstore({
inlineSvg: true
}))
.pipe(rename("sprite.svg"))
.pipe(gulp.dest("build/img"));
});
gulp.task("html", function () {
return gulp.src("source/*.html")
.pipe(posthtml([
include()
]))
.pipe(gulp.dest("build"));
});
gulp.task("images", function () {
return gulp.src("source/img/**/*.{png,jpg,svg}")
.pipe(imagemin([
imagemin.optipng({optimizationLevel: 3}),
imagemin.jpegtran({progressive: true}),
imagemin.svgo()
]))
.pipe(gulp.dest("source/img"));
});
gulp.task("webp", function () {
return gulp.src("source/img/**/*.{png,jpg}")
.pipe(webp({quality: 90}))
.pipe(gulp.dest("source/img"));
});
gulp.task("serve", function() {
server.init({
server: "build/"
});
gulp.watch("sourse/less/**/*.less", ["style"]);
gulp.watch("source/*.html", ["html"]);
});
gulp.task("copy", function () {
return gulp.src([
"source/fonts/**/*.{woff,woff2}",
"source/img/**",
"source/js/**"
], {
base: "source"
})
.pipe(gulp.dest("build"));
});
gulp.task("clean", function () {
return del("build");
});
gulp.task("build", function (done) {
run(
"clean",
"copy",
"style",
"sprite",
"html",
done
);
});
Содержание package.json:
{
"name": "some",
"version": "1.0.0",
"description": "Проект пробный",
"main": "gulpfile.js",
"dependencies": {},
"devDependencies": {
"autoprefixer": "^9.7.4",
"browser-sync": "^2.26.7",
"del": "^5.1.0",
"gulp": "^4.0.2",
"gulp-csso": "^4.0.1",
"gulp-imagemin": "^7.1.0",
"gulp-less": "^4.0.1",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^8.0.0",
"gulp-posthtml": "^3.0.4",
"gulp-rename": "^2.0.0",
"gulp-series": "^1.0.2",
"gulp-svgstore": "^7.0.1",
"gulp-webp": "^4.0.1",
"posthtml-include": "^1.3.3",
"run-sequence": "^2.2.1"
},
"scripts": {
"editorconfig": "editorconfig-cli",
"stylelint": "stylelint 'source/less/**/*.less' --syntax less",
"test": "npm run editorconfig && npm run stylelint",
"build": "gulp build",
"start": "npm run build && gulp serve"
},
"repository": {
"type": "git",
"url": "......"
},
"author": "Nina",
"license": "ISC",
"bugs": {
"url": "
https://github.com/......."
},
"homepage": "
https://github.com/......."
}