Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question