Closed samdbeckham closed 9 years ago
I would really like if the defs
option could be used via a file path instead of a string. I don't like to mix the gruntfile with production data. Maybe call it externalDefs
that can potentially contain an array of files or a single file.
That might not be a bad shout, like a defs.xml file or something. Shouldn't be a difficult change.
How's that? I don't know whether to look through the file and check if they're valid defs or whether that's something that we should just leave to the user.
Maybe we just use a valid svg but only use the <defs>
from it. So the user could create some gradients and test them right in the defs svg but only <defs>
are "imported".
I've swapped it out so it looks for a defs block in the linked file and appends them to the sprite. I've added in some better checks as well. This way you can use an SVG like you mentioned or you could use XML provided it has a valid defs block; best of both worlds.
This looks awesome. I would like to ship this in 0.5.0
Regarding the discussion on #78 I've created an optional
defs
option that allows you to append custom defs to the SVG sprite. This allows you to add in things like custom gradients that are unaffected by the id renaming scheme, allowing you to apply them with CSS to any of the icons in the sprite.