gulp-svg-sprites
gulp-svg-sprites copied to clipboard
no-svg class
Hello -
The generated CSS created a no-svg class by default.
.no-svg .hyicon:before { background-image: url("../icons.png"); }
is there a way to disable this as I have no need to use PNG fallback in my project.
I don't think there is... I've written a regex to remove the css after it's generated:
.pipe(replace(/\.no-svg \.svg-icon\:before\s{[^\r].*sprites\.png\"\);[^\r]}/g, ''))
I thought it might be useful as an aid for anyone else with this issue. My full gulp task is below for context:
var replace = require('gulp-string-replace');
gulp.task('svg:spritesheet:build', function() {
return gulp.src('src/public/images/svg/*.svg')
.pipe(svgSprite({
common: "svg-icon",
cssFile: "../scss/sprites.scss",
svg: { sprite: "../images/sprites.svg" },
svgPath: '/images/sprites.svg',
preview: false
}))
.pipe(replace(/\.no-svg \.svg-icon\:before\s{[^\r].*sprites\.png\"\);[^\r]}/g, ''))
.pipe(gulp.dest("src/public/images/"));
});