ibm-js / requirejs-dplugins

AMD plugins for RequireJS
http://ibm-js.github.io/requirejs-dplugins/
Other
6 stars 9 forks source link

Svg plugin is returning the id of the graphic inserted while it should the id of the icon requested. #29

Closed clmath closed 8 years ago

clmath commented 8 years ago

From #26:

One issue I notice is that svg!icon.svg will normally evaluate to icon.svg (i.e require(["svg!icon1.svg"], function(id){ console.log(id); }) will print icon.svg), except when icon1.svg is inside a sprite. At that point it evaluates to sprite.svg or something like that. Shouldn't it still evaluate to icon.svg?

I think the plugin should return the id of the svg graphic requested. This may be the file name of the svg or the content of the id attribute on the symbol element. The tricky part is to keep the binding between requested file name and icon id when we load the sprite.

wkeese commented 8 years ago

As I explained in #30, this should be fixed before people start using the plugin, because code that uses the plugin should get the id from the plugin return value, rather than assuming the id matches the filename.