Skip to content

Instantly share code, notes, and snippets.

@davatron5000
Last active May 13, 2019 05:48
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davatron5000/13579518dfdddf5bba66 to your computer and use it in GitHub Desktop.
Save davatron5000/13579518dfdddf5bba66 to your computer and use it in GitHub Desktop.
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