@noprompt hi 👋
I would like to contribute for the https://github.com/noprompt/garden/issues/171, but first I wanted to ask a few questions.
Does garden have any sort of visitor, a spec about the garden data format or anything like that ?
It would be handy for writing any kind of garden-rewriting function.
@vincent.cantin No, but I’m sure it’s possible to fit something on top of it. The design is pretty bad; it was one of my first “serious” Clojure projects. You probably noticed, a second version in the works — the aleph
branch — but it too needs work.
A zipper traversal is probably possible. I tend to stay away from spec these days.
I did not know about the aleph branch. I made a library which is creating garden data (https://github.com/green-coder/girouette), that’s the reason I am interested in improving Garden.
Oh man would I love help
I’m very busy with meander, my day job, and family.
I would be happy to explain in detail where the aleph branch needs to be in terms of release quality.
Maybe I could write a data model for the Garden format using Minimallist and use it to visit the nodes.
Apologies if I sound desperate! 🙂
I am equally desesperate for help with my projects, I totally understand you 😅
Cool.
If you would like to work on the current released version that’d be great too.
I think what would really help would be to have a proper “parse” phase to get the data into a format which can be more easily manipulated.
This is what I was doing on the aleph
branch: a protocol for parsing stuff into AST nodes (maps) and separate phases for manipulating /compiling those.
Two things need to happen on that branch: 1. the parser needs to be written in vanilla clojure, no spec, no conform, etc. 2. finish up the docs (but this is less important than the first)
For the current branch, I think fitting a proper parser could work just as well.
By “vanilla clojure”, what do you mean? what is your goal exactly?
(garden.parse/parse ["h1" {:font-weight "bold"}])
;; =>
[:rule [:block [:selector "h1"] ,,,]]]
Something like this or whatever (probably maps not hiccup though)By “vanilla clojure” I just mean no spec or other libraries.
Your goal is not to have dependencies ?
spec can be nice for annotating stuff on the side but conform
is too slow.
Yes, no dependencies.
Otherwise, I’d just write the whole thing using Meander.
It’s way easier. 🙂
FWIW, I think the idea you mentioned on the ticket is similar to what happens on aleph
branch IIRC
Basically pulling the media query up.
I will take a look at the aleph
branch in the next couple of days.
In the near future, do you plan to maintain both branches master
and aleph
or do you plan to replace master
when you can?
I think this could be done with a zipper by finding the media query node, replacing it with it’s contents, then replacing that path along the tree with the media query e.g.
[,,, [,,, (at-media {,,,} <stuff>)]]
;; =>
(at-media {,,,} [,,, [,,, <stuff>]])
No, I would want stick with aleph
after.
I always support accepting patches, etc though.
I think that you should write it somewhere in the README.md, because many contributors may not know that and will work only on master.
Communicate on the direction of the project so that people can be side by side with you.
Small detail: the git branch is spelled alef
, not aleph
LOL
My mistake 🙂
I certainly mean that
Re: communication: I’ve mentioned needing help on main README.
At some point in Girouette, I will want to group CSS rules which belong in the same media queries. It’s at that point that having all the media queries at the root will be useful.
For now, I use a work around in my code to construct my data with the media query at the root, but it’s a little hacky.
TBH, and I’ve mentioned this in the #meander channel as well, I’m very bad a writing documentation/sending emails. OTOH I’m usually very good at replying here in this format.
The reason is that between the things I enumerated earlier which occupy my time and mind is a head in the clouds.
tl;dr I’m happy to help here and also in DMs
I also struggle with time, having a full time job not even related to Clojure and a family to take care of. I got your point.
Young kids take a lot of input 🙂
I might have time next week to look at alph and see what I can do on it.
I have 3 😛
You +1 me, I have 2
Ha!
Any number of kids beyond one is difficult
I think someone said the difficulty is squared for each one you have 😄
But I promise you, if you want to work on the project I will give you my full support
@noprompt I will cut a first release for Girouette first, then see how to improve Garden right after.
Works for me. Keep in touch.
I would say it’s log
if you can teach them to take care of each other.
I look forward to that day. 🙂
If you want to add something to what is on master you could do it before here: https://github.com/noprompt/garden/blob/master/src/garden/compiler.cljc#L765
You could create a separate step for finding the media queries and properly hoisting them to the top level as you suggested.