Last active
May 13, 2019 05:48
-
-
Save davatron5000/13579518dfdddf5bba66 to your computer and use it in GitHub Desktop.
Gulpin' SVGz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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