Can someone explain why i would want to use tailwind? I assume it's an optimization as h-12 is harder to understand then height 12
My intuition is always that what you want is something to read :height 12
and produce the class (if it's reused/faster) as a complier stage. Then you can treat your css just like any other clojure var (def button {:blah "blah" :foo "bar}) or maybe even just one giant hashmap called "styles".
i believe the idea is two-fold. first, makes writing the css inline easier: instead of having to say: style="height: 12px"
, you can say class="h-12"
and it'll handle the transformation for you. second, decouples/removes the cascading part, so you don't have to say style="height: 12px"
and then in the nested thing say style="height: 16px"
or whatever.
and then tailwind handles building the correct css for each section behind the scenes
but i've not actually used it, that's just what i've gotten from reading the docs a while back
thanks for the input. My take away from reading about it for about half an hour now is that it's just prebuilt css classes. If true, i wish they would just say as much rather then all the marketing fluff. I understand the need, but it's next to impossible to want to buy into something when everything is "amazing" "fast" "easy"!
hah yeah, i definitely feel that
ok, so at a glance this library does what i suggested https://github.com/clj-commons/cljss
> defstyles
macro expands into a function which accepts an arbitrary number of arguments and returns a string of auto-generated class names that references both static and dynamic styles.
> (defstyles button [bg]
> {:font-size "14px"
> :background-color bg})
>
> (button "#000")
> ;; "-css-43696 -vars-43696"
i guess by dynamic style they mean ones created by functions. or maybe css really has functions, i think it's sort of irrelevant depending on how you compile it. My personal goal I have in any project is to only have to deal with clojure data in my program (not css).
oh it says on the next line: > Dynamic styles are updated via CSS Variables (see http://caniuse.com/#feat=css-variables).
> Custom properties (sometimes referred to as CSS variables or cascading variables) are entities defined by CSS authors that contain specific values to be reused throughout a document.Feb 3, 2021 Or cascading? cascading implies it would flow down the dom tree to me. But that's a lot more then "reusable" why are definations so hard to understand without examples.
i don't think it cascades at all..