我正在尝试运行任务"icons",它将同时运行两个不同的任务,但当我尝试运行它时,我会收到错误消息。我尝试了很多不同的方法,但都没有成功,所以如果有人知道如何修复它,请告诉我:(
我将在下面发布我的代码:
const gulp = require('gulp');
const svgSprite = require('gulp-svg-sprite');
const rename = require('gulp-rename');
const config = {
mode: {
css: {
render: {
css: {
template: './gulp/templates/sprite.css'
}
}
}
}
}
gulp.task('createSprite', function() {
return gulp.src('./app/assets/images/icons/**/*.svg')
.pipe(svgSprite(config))
.pipe(gulp.dest('./app/temp/sprite/'));
});
gulp.task('copySpriteCSS',['createSprite'], function() {
return gulp.src('./app/temp/sprite/css/*.css')
.pipe(rename('_sprite.css'))
.pipe(gulp.dest('./app/assets/styles/modules'));
});
gulp.task('icons', ['createSprite, copySpriteCSS']);
我得到的错误是:
[08:29:03] Using gulpfile ~travel-agency-websitegulpfile.js
[08:29:03] Task 'createSprite, copySpriteCSS' is not in your gulpfile
[08:29:03] Please check the documentation for proper gulpfile formatting
尝试:
gulp.task('copySpriteCSS', gulp.series('createSprite', function() {
return gulp.src('./app/temp/sprite/css/*.css')
.pipe(rename('_sprite.css'))
.pipe(gulp.dest('./app/assets/styles/modules'));
}));
gulp.task('icons', gulp.parallel('createSprite', 'copySpriteCss'));
你有gulpv3代码,我想你使用的是gulpv4。从v3 tp v4中搜索迁移指南。