rtfeldman / elm-css

Typed CSS in Elm.
https://package.elm-lang.org/packages/rtfeldman/elm-css/latest
BSD 3-Clause "New" or "Revised" License
1.24k stars 197 forks source link

Empty style node emitted if no styles #539

Open arsduo opened 3 years ago

arsduo commented 3 years ago

Because of a weird situation with an unusual legacy UI framework in our Elm code, I noticed that elm-css will emit an empty style node if there are no classes. Generally that's not an issue, but inside a large table where each cell contains some rendered Html.Styled, it noticeably affects the performance of the page.

This is a problem with our code more than elm-css, but it's worth potentially improving the library as well. What do you think of not emitting the style node if the list of styles for a given node is empty? (For instance here and equivalent methods.)

Happy to put up a PR if this seems reasonable.

rtfeldman commented 3 years ago

Happy to accept a PR for this! 👍