Skip to content

Instantly share code, notes, and snippets.

@jarcoal

jarcoal/Gruntfile.js

Created Apr 10, 2015
Embed
What would you like to do?
SVG Sprite Color
var svgColor = function(color) {
return function(shape, sprite, callback) {
var paths = shape.dom.getElementsByTagName('path');
for (var i = 0; i < paths.length; i++) {
paths[i].setAttribute('fill', color);
}
callback(null);
};
};
module.exports = function(grunt) {
grunt.initConfig({
svg_sprite: {
// ...
options: {
// svgo must appear in transform list
transform: ['svgo', {
// 'dark' can be changed for any value
dark: svgColor('#FFF')
}],
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment