react-css-modules.macro
react-css-modules.macro copied to clipboard
Not working with extra spaces in styleName
When styleName
contains extra spaces, the library doesn't work. In fact the entire output of the component disappears rather than giving a warning.
Extra spaces can be present as a result of conditional styles.
For example, when isLoggedIn
is false, the resulting string becomes class1
(with an extra space at the end).
<div styleName={'class1 ' + (isLoggedIn ? 'green' : '')}>Hi</div>
Of course, this can very easily be worked around by moving the space from class1
to isLoggedIn
.
I believe empty strings should be filtered out after splitting on space in https://github.com/bohdanbirdie/react-css-modules.macro/blob/f3a53bc40ab654ba88978c16f90e2d6b234a4189/src/macro.js#L97-L99
Hi! Yep, good catch Would you like to create a PR? I will be glad to merge it ;)