Fork me on GitHub
#lambdaisland
<
2020-12-03
>
Vincent Cantin16:12:15

Some regex fun: https://twitter.com/chrishouser/status/1334358203245752322 Can we name the captured expression in Regal?

plexus16:12:14

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 🙂

Vincent Cantin16:12:01

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.

Vincent Cantin16:12:38

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.

plexus16:12:22

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

👀 3
Vincent Cantin16:12:57

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.

plexus16:12:02

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 production

plexus16:12:27

has been working really well for us on the lambda island redesign

Vincent Cantin16:12:28

I am thinking more like having classes describing elementary things like .mr-109px which mean marge on the right with 109 pixels.

Vincent Cantin16:12:57

where the user can describe a grammar for the possible class names, in a convenient way

Vincent Cantin16:12:44

… and most importantly, how to map their parsed parts to names, bidirectionally.

Vincent Cantin16:12:00

I will give it some time and think.

borkdude17:12:50

> 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.

plexus18:12:51

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.