jhamlet / svg-react-loader

Webpack SVG to React Component Loader
MIT License
559 stars 82 forks source link

Allow user-specified unaltered attributes #23

Closed jfurrow closed 8 years ago

jfurrow commented 8 years ago

Hey, thanks for this loader! It's really helpful.

I would like the ability to specify a whitelist of attributes that should not be camel-cased. Right now the loader will output all fill-rule attributes as fillRule, which React 0.14.x doesn't interpret properly.

By making use of React's #isCustomAttribute, it is possible to instruct React to create fill-rule attributes properly. However fill-rule must be specified with the hyphen, instead of the camel-cased fillRule as this loader currently produces.

I've tested this by adding a 'fill-rule' key and value to the RESERVED_KEYS hash in sanitize.js and it works as expected.

If you've already address a workaround for this, I apologize for not finding it!

jhamlet commented 8 years ago

@jfurrow -- I will see if I can address this... in some way... in the meantime can you provide me links to any appropriate documentation you have for the #isCustomAttribute usage for React?

jfurrow commented 8 years ago

@jhamlet Sorry for the delay. I did end up finding a workaround within React, so my request is probably not necessary. But here's how it was solved: https://github.com/dcos/dcos-ui/blob/master/src/js/utils/ReactSVG.js

Feel free to close this issue, unless you think it's worth implementing.

jhamlet commented 8 years ago

Now available in v0.4.0-beta.2