Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gulpin' SVGz
var cheerio = require('gulp-cheerio');
var svgmin = require('gulp-svgmin');
var svgstore = require('gulp-svgstore');
gulp.task('svgstore', function () {
return gulp
.src('assets/icons/*.svg')
.pipe(svgmin())
.pipe(svgstore({ fileName: 'icons.svg', prefix: 'icon-' }))
.pipe(cheerio({
run: function ($) {
$('[fill]').removeAttr('fill');
$('symbol').attr('fill','currentColor');
},
parserOptions: { xmlMode: true }
}))
.pipe(gulp.dest('assets/'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.