weavejester / hiccup

Fast library for rendering HTML in Clojure
http://weavejester.github.io/hiccup
Eclipse Public License 1.0
2.68k stars 174 forks source link

Support reagent-style map style attributes #136

Closed pesterhazy closed 7 years ago

pesterhazy commented 8 years ago

Reagent supports an extension to hiccup's syntax:

[:div {:style {:color :red, :margin-top "75px"}} "text"]

as a more readable version of

[:div {:style "color: red; margin-top: 75px"} "text"]

:margin-top 75 also works. This is a useful extension and quite natural. It's also mildly surprising for people coming from reagent (back) to hiccup that this doesn't work in hiccup pure.

Would you be interested in such an extension?

weavejester commented 8 years ago

This is reasonable, as long as string values are still supported for styles to retain backward compatibility.

weavejester commented 7 years ago

Fixed by #139.

theronic commented 4 years ago

Which Hiccup version supports style attributes as a map?

theronic commented 4 years ago

Answer: 2.0.0-alpha1

This just bit me but I've asked before :) https://github.com/weavejester/hiccup/pull/139#issuecomment-355088387