Answer the question
In order to leave comments, you need to log in
How to create sprites in Gulp using gulp.spritesmith?
Good day! Tell me how to fix the error when generating sprites in Gulp.
The task itself for sprites:
gulp.task('sprite', function () {
var spriteData =
gulp.src('./src/sprite/*') // путь, откуда берем картинки для спрайта
.pipe(spritesmith({
imgName: 'sprite.png',
cssName: 'sprite.scss',
cssFormat: 'scss',
algorithm: 'binary-tree',
cssTemplate: 'scss.template.mustache',
imgPath: "../sprite/sprite.png",
cssVarMap: function (sprite) {
sprite.name = sprite.name
}
}));
spriteData.img.pipe(gulp.dest('./build/sprite/')); // путь, куда сохраняем картинку
spriteData.css.pipe(gulp.dest('./src/scss/')); // путь, куда сохраняем стили
});
gulp.task('css', function () {
return gulp.src(components.scss)
.pipe(autoprefixer({
browsers: ['last 8 versions'],
cascade: false
}))
.pipe(sass().on('error', sass.logError))
.pipe(concat("style.css"))
.pipe(minify_css())
.pipe(gulp.dest('build/css'));
});
@import "sprite.scss";
@import "helpers.scss";
*{
margin: 0;
padding: 0;
}
body{
font-size: 16px;
}
.sprite{
@include sprite($vk);
}
Answer the question
In order to leave comments, you need to log in
Select all layers with a similar font and replace it.
In the CSS processing task, put an autoprefixer after the sass job
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question