-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I define multiple sub-tasks? #130
Comments
Actually, ideally I'd want to combine them all into the same sprite, but I can see no way to change the cleanup behaviour for different symbols. I was gonna look at hacking the source to see how that might be possible. |
Ran across the same problem on another project and then found my own question while looking for the answer again. I previously got around this problem by duplicating the svgstore module and renaming it. svgstore: {
options: {
prefix: '', // This will prefix each ID
svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG
xmlns: 'http://www.w3.org/2000/svg'
, width: 0
, height: 0
, style: 'width:0;height:0;display:none;'
},
cleanup: ['fill', 'style'],
cleanupdefs: false
},
default: {
files: {
'assets/icon-sprite.svg': ['_icons/*.svg']
}
},
color: {
options: {
prefix: '', // This will prefix each ID
svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG
xmlns: 'http://www.w3.org/2000/svg'
, width: 0
, height: 0
, style: 'width:0;height:0;display:none;'
},
cleanup: false,
cleanupdefs: false
},
files: {
'assets/icon-sprite-colour.svg': ['_icons/preserve-colours/*.svg']
}
}
}, Any svg files dropped into _icons are processed through the default options and merged in the icon-sprite.svg file stripped of their style and fill attributes so they can be styled with CSS. Any svgs dropped into the preserve-colours subdirectory within _icons are merged into the icon-sprite-colour.svg file and they aren't cleaned up. Thanks, me from the future. |
I've looked at various answers on StackOverflow but none directly concern using grunt-svgstore and despite fiddling with them I can't get it to work.
What I want to achieve is to have TWO sprites, compiled from two different directories of svgs. One will be my usual icon set with all the fills stripped out so they can be styled with CSS, the other should be full colour versions which wouldn't be influenced by CSS.
Any idea how I'd achieve such a thing?
Here are my combined tasks, but I'm having trouble setting them to run. I tried all sorts of combinations in grunt.registerTask(), and tried removing grunt.loadNpmTasks() and changing the task lists in my watch configuration.
svgstore: { mono: { options: { prefix: '', // This will prefix each ID svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG xmlns: 'http://www.w3.org/2000/svg' , width: 0 , height: 0 , style: 'width:0;height:0;display:none;' }, cleanup: true, cleanupdefs: false }, default: { files: { 'sites/app/images/sprite.svg': ['sites/app/images/svg_src/*.svg'], }, } }, colour: { options: { prefix : '', // This will prefix each ID svg: { // will add and overide the the default xmlns="http://www.w3.org/2000/svg" attribute to the resulting SVG xmlns: 'http://www.w3.org/2000/svg' ,width: 0 ,height: 0 ,style: 'width:0;height:0;display:none;' }, cleanup: true, cleanupdefs: false }, default : { files: { 'sites/app/images/sprite_coloured.svg': ['sites/app/images/svg_colour_src/*.svg'], }, } } },
The text was updated successfully, but these errors were encountered: