M
M
massef2015-06-02 16:09:14
JavaScript
massef, 2015-06-02 16:09:14

gulp. What is causing this error?

Hello.
I generate sprites with gulp, everything worked fine, but now it gives an error Error: Invalid file type
I don't understand which files it doesn't like. The gulp.spritesmith
plugin is used . All sources for a sprite of the same format. In short, everything worked fine before, I didn’t change anything in gulpfile.js, I just add images if necessary and that’s it. Updated gulp itself both globally and locally, gulp.spritesmith also updated. Googled by mistake, found nothing. Who faced? Sprite generation task:

gulp.task('sprite:build', function() {
  var spriteData = 
    gulp.src(path.src.spriteOrigin) // путь, откуда берем картинки для спрайта
      .pipe(plumber())
      .pipe(spritesmith({
        imgName: path.build.spriteImgName, // записывается в шаблон
        cssName: '_sprite-data2.scss', // название файла с переменными
        cssFormat: 'scss', // формат css переменных
        algorithm: 'binary-tree',
        cssTemplate: 'sass.template.mustache', // массив данных для спрайта
        cssVarMap: function(sprite) {
          sprite.name = 's-' + sprite.name
        }
      }));

  spriteData.img.pipe(gulp.dest(path.build.spriteImgPath)); // путь, куда сохраняем картинку
  spriteData.css.pipe(gulp.dest(path.src.spriteSass)); // путь, куда сохраняем стили
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
teotlu, 2015-06-02
@massef

This may be due to some file that is not a picture, lying in the folder where you have pictures.
For example, if it is on the localhost, then some Thumbs.db.
Try setting the extensions explicitly, like this:
I had the same error, it worked for me.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question