K
K
Kira2016-10-25 21:04:48
gulp.js
Kira, 2016-10-25 21:04:48

Error 'Task gulp.spritesmith is not in your gulpfile'?

Hello. There was such an error when trying to run
spritesmith in gulp
there is spritesmith in gulpfile, it is also in package.json after installation.
2c6b1541e2b84c29aaba413269b2e548.png

var gulp = require('gulp'),
    sass = require('gulp-ruby-sass'),
    autoprefixer = require('gulp-autoprefixer'),
    browserSync = require('browser-sync').create(),
    pug = require('gulp-pug'),
  spritesmith = require('gulp.spritesmith'),
    prettify = require('gulp-prettify'),
    uncss = require('gulp-uncss');

gulp.task('sprite', function () {
  var spriteData = gulp.src('img/icons/*.png').pipe(spritesmith({
    imgName: 'sprite.png',
    cssName: 'sprite.sass',
    imgPath: '/img/sprite.png' 
  }));
  spriteData.css.pipe(gulp.dest('./sass/'));
  spriteData.img.pipe(gulp.dest('./img/'));  
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2016-10-25
@Allan11

gulp sprite
You need to run by the name of the task, not the module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question