This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-25
Channels
- # announcements (16)
- # babashka (110)
- # babashka-sci-dev (11)
- # beginners (50)
- # biff (3)
- # calva (1)
- # clj-commons (19)
- # clj-kondo (1)
- # clojure (17)
- # clojure-art (19)
- # clojure-austin (5)
- # clojure-berlin (2)
- # clojure-denmark (3)
- # clojure-europe (101)
- # clojurescript (84)
- # clr (1)
- # core-async (2)
- # emacs (3)
- # helix (5)
- # honeysql (4)
- # hyperfiddle (8)
- # introduce-yourself (2)
- # jobs (1)
- # lsp (18)
- # membrane (3)
- # reagent (5)
- # releases (3)
- # shadow-cljs (10)
- # tools-deps (24)
I am attempting to use the shadow-css library with electric. Shadow-css has one main macro css
which outputs a class string (https://github.com/thheller/shadow-css#using-the-css-macro).
When I try to use that macro and write:
(dom/h1 (dom/props {:class (css {:color "red"})})
(dom/text "minimal todo list"))
I get this error:
(def electric-main
8 | (hyperfiddle.electric/boot ; Electric macroexpansion - Clojure to signals compiler
---------^----------------------------------------------------------------------
Can't take value of macro shadow.css/css
Is that expected behavior at this point? Or is there a different way I could use this library with electric?trying to repro
I like put the styles in a global map as:
(def styles
{:my-component/container (css :flex)
:my-component/title (css :text-gray-800)})
And in electric component:
(dom/h1 (dom/props {:class (styles :my-component/title)}))
This method works perfectly with electrictrue, but then I have to give names to everything, which I'd prefer not to be required to do everywhere
i've reproduced but don't understand it, will need to pass it on to the team
This is a bug in the handling of :class . :class can take a string or a collection of strings. Here the props macro thinks (css ...) is a list of classes.
ah, I see. ok, I can workaround for now with J's suggestion until there's a fix. Thanks for looking into this so quickly!
This is fixed on latest master