Task 'createSprite, copySpriteCSS' is not in your gulpfile

35 Views Asked by At

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

1

There are 1 best solutions below

0
On

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.