@rap1ds that's pretty cool.
can you share that macro?
Is there a way to stringify a Color so that it takes into account :alpha
? All functions converting to hex seem to forget about it.
I'm actually using CLJS but I want the css to be a static css file and not compiled into the js bundle. Makes sense?
@rap1ds @guswill I am working on something like this which is a complete tool that provides much more, such as very aggressive CSS optimization that modifies CLJS advanced builds. It actually entirely replaces CSS in JS by being much more effective and completely static, no runtime cost whatsoever π But creating such namespaced names for classes, ids, vars and so one was the primary goal. Then it was about munging those names into something short at release, and then I noticed it allowed for statically analyzing Garden rules in order to combine-split classes and provide dead code elimination. I really enjoy it. It is very recent sot I'll open-source after a while when I find time to document it
that's pretty cool @adam678. I will definitely give it a try when you decide to open source it. is garden a dependency in your lib?
what I've noticed is that most css libs that "scope" components either don't mention how packaging is done or just plain bundles together with the js which, to me, is a no go.
@guswill At first it was not strictly coupled but then it simplified things to do it yes. In theory it does not need to but it is more convenient to use
css-in-js makes for a very poor user xp
When it comes to config that's the thing, there is barely anything to configure. The idea is very simple and all the heavy stuff is actually leveraging CLJ(S) tooling.
In a gist, the idea is to go further than namespacing those names by appending and prepending very recognizable tokens. Then it is a piece of cake to detect those unique strings in an advanced build and later replace them. This alone provides dead code elimination, we know which of those special names didn't survive advanced compilation (and hence are not needed in our Garden rules).
does it use external js deps like purgecss?
And it is trivial to munge those special names both in the CSS and in the advanced CLJS builds
ok, so the lib builds a "registry" of queries and purges anything that isn't mentioned there?
Exactly, by extracting those names from an advanced CLJS build with a simple regex, we can then do pretty amazing stuff with our Garden rules and provide particularly aggressive optimizations π
My lib is currently 500 lines of code at most and it solves right away stuff that people write whole articles about in the JS world. Clojure(script) for the win!
that's pretty cool! looking forward to see it. Yeah, the power of code-as-data ftw π
It doesnβt look like it. However, if you would like to update what is currently on master to allow for that, I would happily merge the contribution. π