Outputting multiple spritesheets for different folders
Closed this issue · 3 comments
I was wondering if there was a way for someone to reference different folders that would output individual spritesheets for those folders.
So for example if I had two folders with images
/spritesForPageOne/*.png
/spritesForPageTwo/*.png
It would create two separate spritesheets
spritesForPageOne-spritesheet.png
spritesForPageOne-spritesheet.css
spritesForPageTwo-spritesheet.png
spritesForPageTwo-spritesheet.css
As of right now I believe it will only let me specify one spritesheet destination?
This can be done by creating 2 tasks
grunt.initConfig({
sprite:{
pageOne: {
src: 'spritesForPageOne/*.png',
destImg: 'spritesForPageOne-spritesheet.png',
destCSS: 'spritesForPageOne-spritesheet.css'
},
pageOne: {
src: 'spritesForPageTwo/*.png',
destImg: 'spritesForPageTwo-spritesheet.png',
destCSS: 'spritesForPageTwo-spritesheet.css'
}
}
});
Running grunt sprite
will run both tasks
grunt sprite # Runs pageOne and pageTwo
Each task can be run exclusively by
grunt sprite:pageOne # Runs pageOne only
grunt sprite:pageTwo # Runs pageTwo only
Ahh I apologize -- didn't realize this was a grunt specific thing. Thank you very much for the clarification 👍
Thanks for the example, I was trying to create multiple sprites but couldn't figure it out from reading the documentation.