V
V
vovkka2017-02-24 19:39:53
css
vovkka, 2017-02-24 19:39:53

Spritesmith does not overwrite the generated stylesheet if there are no icons, how to solve?

Good evening.
The essence of the problem is that I throw icons into the icon folder ... if there are icons, then the final scss file is generated well, and if it is empty, then the file is not updated to 0 .... that is, it pulls extra css ... How to overcome this ?

gulp.task('sprite', function() {
    var spriteData = 
        gulp.src('app/img/icon/*.*') // путь, откуда берем картинки для спрайта
            .pipe(spritesmith({
                imgName: 'sprite.png',
                cssName: '_sprite.scss',
                cssFormat: 'scss', // в каком формате выводить css
                algorithm: 'binary-tree', // алгоритм сортировки иконок в спрайте
                imgPath: '../img/sprite.png', // путь до спрайта
                padding: 1,
                // retinaSrcFilter: '*-2x.png',
                // retinaImgName: 'sprite-2x.png'
                //cssTemplate: 'stylus.template.mustache',
                // cssVarMap: function(sprite) {
                //     sprite.name = 's-' + sprite.name
                // }
            }));

    spriteData.img.pipe(gulp.dest('app/img/')); // путь, куда сохраняем картинку
    spriteData.css.pipe(gulp.dest('app/sass/')); // путь, куда сохраняем стили
});

Thanks to all

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question