garden

GusWill 2021-01-16T17:08:04.001400Z

@rap1ds that's pretty cool.

GusWill 2021-01-16T17:08:23.002Z

can you share that macro?

Helins 2021-01-16T17:08:36.002500Z

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.

GusWill 2021-01-16T17:09:05.003300Z

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?

Helins 2021-01-16T17:13:58.007500Z

@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

πŸ‘Œ 1
GusWill 2021-01-16T17:16:29.009Z

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?

GusWill 2021-01-16T17:18:18.011Z

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.

Helins 2021-01-16T17:18:44.011500Z

@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

GusWill 2021-01-16T17:18:48.011800Z

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

Helins 2021-01-16T17:19:57.012900Z

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.

Helins 2021-01-16T17:22:01.015200Z

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

GusWill 2021-01-16T17:22:38.016Z

does it use external js deps like purgecss?

Helins 2021-01-16T17:22:44.016200Z

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

GusWill 2021-01-16T17:23:25.016900Z

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

Helins 2021-01-16T17:25:02.018200Z

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

Helins 2021-01-16T17:25:48.019100Z

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!

πŸŽ‰ 1
GusWill 2021-01-16T17:27:39.019900Z

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

πŸ‘ 1
noprompt 2021-01-16T20:49:09.020100Z

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

πŸ‘ 1