Some regex fun: https://twitter.com/chrishouser/status/1334358203245752322 Can we name the captured expression in Regal?
No, not supported because JS doesn't support it. It's a proposal though so once ClojureScript uses a new enough variant of Ecmascript we can consider it 🙂
I started a small library similar to tailwindcss, but designed in a Clojure way, taking advantage of the macro system to read the name of the classes and generate them as you go. I thought about using Regal for it, but was blocked by that specific missing feature. So I using Minimallist for now.
That’s a kind-of-new way to generate css … grammar-based generation instead of config-based like tailwind where there is a garbage collector for all the generated and unused classes which are removed for production builds.
interesting, we may actually release a library in the near future for doing css-in-js style stuff, but on the backend, on top of garden
Ideally, I wish that the user of my library to be able to write down their own syntax in a easy way. I am still thinking about how to make it easy to describe.
basically you define styled component like this
(o/defstyled description :div
{:max-width "29rem !important"
:min-width "20rem"
:justify-self "center"
:align-self "center"
:grid-area "2 / 2 / 3"})
then use it in your hiccup
[description ...]
;; or
[:p {:class [description]} ...]
and it ends up as a generated class in a css file on productionhas been working really well for us on the lambda island redesign
I am thinking more like having classes describing elementary things like .mr-109px
which mean marge on the right with 109 pixels.
where the user can describe a grammar for the possible class names, in a convenient way
… and most importantly, how to map their parsed parts to names, bidirectionally.
I will give it some time and think.
> No, not supported because JS doesn't support it. You could also consider exposing platform-specific features and not the lowest common denominator, as long as it's documented.
that would go against one of the core design principles of Regal. We're also just not adding syntax right now until all parts (especially the generator generators) have stabilized.