Fork me on GitHub
#reagent
<
2018-11-14
>
jlfischer22:11:08

Is there any way to render an inline <style> element in reagent? For example, the demo SVG on this MDN page? https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text

mikethompson22:11:14

@jlfischer Never tried it, but this should work .... [:style ".small { font: italic }\n .heavy { ....}"]

andrewzhurov11:11:15

@jlfischer @U051MTYAB With garden it looks great

(def styles
  [[:.small {:font-size "italic"}]
   [:.heavy {:font-weight "600"}])

[:style (garden.core/css styles)]
https://github.com/noprompt/garden

jlfischer22:11:45

Hah, that feels like cheating. 😛

mikethompson22:11:26

You can use [:span (clojure.string/join "\n" vec-of-css-lines)] if it makes you feel better :-)

escherize02:11:21

Nitpick: s/:span/:style

jlfischer22:11:58

Not particularly. That did work though, thank you!

4
polymeris23:11:24

this is more of a react than a reagent question, I guess, but if you have an element like <style>..</style> containing a long string and you change a small part of it, all the react magic with diffing doesn't help, right? it just has to recreate the whole thing