Fork me on GitHub
#garden
<
2021-01-16
>
GusWill17:01:04

@rap1ds that's pretty cool.

GusWill17:01:23

can you share that macro?

Adam Helins17:01:36

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.

noprompt20:01:09

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. πŸ™‚

πŸ‘ 3
GusWill17:01:05

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?

Adam Helins17:01:58

@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

πŸ‘Œ 3
GusWill17:01:29

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?

GusWill17:01:18

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.

Adam Helins17:01:44

@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

GusWill17:01:48

css-in-js makes for a very poor user xp

Adam Helins17:01:57

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.

Adam Helins17:01:01

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

GusWill17:01:38

does it use external js deps like purgecss?

Adam Helins17:01:44

And it is trivial to munge those special names both in the CSS and in the advanced CLJS builds

GusWill17:01:25

ok, so the lib builds a "registry" of queries and purges anything that isn't mentioned there?

Adam Helins17:01:02

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 πŸ™‚

Adam Helins17:01:48

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!

πŸŽ‰ 3
GusWill17:01:39

that's pretty cool! looking forward to see it. Yeah, the power of code-as-data ftw πŸ˜ƒ

πŸ‘ 3