简体   繁体   中英

Task 'createSprite, copySpriteCSS' is not in your gulpfile

I am trying to run task 'icons' which is going to run two different tasks at the same time, but when I try running it, I get the error message. I've tried many different things to do, but unsuccessfully, so if anyone has an idea how to fix it, please let me know:)

I will post my code below:


 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']);

And the error that I get is:


 [08:29:03] Using gulpfile ~\travel-agency-website\gulpfile.js [08:29:03] Task 'createSprite, copySpriteCSS' is not in your gulpfile [08:29:03] Please check the documentation for proper gulpfile formatting

Try:

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'));

You had gulp v3 code, I assume you are using gulp v4. Search for a migration guide from v3 tp v4.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM