garden

2021-02-02T05:48:12.000700Z

@noprompt hi 👋

2021-02-02T05:48:47.001500Z

I would like to contribute for the https://github.com/noprompt/garden/issues/171, but first I wanted to ask a few questions.

2021-02-02T05:49:20.002300Z

Does garden have any sort of visitor, a spec about the garden data format or anything like that ?

2021-02-02T05:50:16.003100Z

It would be handy for writing any kind of garden-rewriting function.

noprompt 2021-02-02T06:27:19.005500Z

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

noprompt 2021-02-02T06:30:00.007800Z

A zipper traversal is probably possible. I tend to stay away from spec these days.

2021-02-02T06:30:23.008300Z

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.

noprompt 2021-02-02T06:30:39.008700Z

Oh man would I love help

noprompt 2021-02-02T06:31:00.009500Z

I’m very busy with meander, my day job, and family.

noprompt 2021-02-02T06:31:45.010600Z

I would be happy to explain in detail where the aleph branch needs to be in terms of release quality.

2021-02-02T06:32:00.011Z

Maybe I could write a data model for the Garden format using Minimallist and use it to visit the nodes.

noprompt 2021-02-02T06:32:01.011100Z

Apologies if I sound desperate! 🙂

2021-02-02T06:32:44.012100Z

I am equally desesperate for help with my projects, I totally understand you 😅

noprompt 2021-02-02T06:33:14.012600Z

Cool.

noprompt 2021-02-02T06:33:50.013200Z

If you would like to work on the current released version that’d be great too.

noprompt 2021-02-02T06:34:44.014100Z

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.

noprompt 2021-02-02T06:35:43.015300Z

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.

noprompt 2021-02-02T06:37:27.017Z

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)

noprompt 2021-02-02T06:37:55.017800Z

For the current branch, I think fitting a proper parser could work just as well.

2021-02-02T06:39:29.019900Z

By “vanilla clojure”, what do you mean? what is your goal exactly?

noprompt 2021-02-02T06:40:19.020900Z

(garden.parse/parse ["h1" {:font-weight "bold"}])
;; =>
[:rule [:block [:selector "h1"] ,,,]]]
Something like this or whatever (probably maps not hiccup though)

noprompt 2021-02-02T06:40:39.021500Z

By “vanilla clojure” I just mean no spec or other libraries.

2021-02-02T06:41:06.022200Z

Your goal is not to have dependencies ?

noprompt 2021-02-02T06:41:42.022800Z

spec can be nice for annotating stuff on the side but conform is too slow.

noprompt 2021-02-02T06:41:48.023Z

Yes, no dependencies.

noprompt 2021-02-02T06:41:59.023300Z

Otherwise, I’d just write the whole thing using Meander.

noprompt 2021-02-02T06:42:07.023600Z

It’s way easier. 🙂

noprompt 2021-02-02T06:43:20.024200Z

FWIW, I think the idea you mentioned on the ticket is similar to what happens on aleph branch IIRC

noprompt 2021-02-02T06:43:49.024600Z

Basically pulling the media query up.

2021-02-02T06:45:02.025400Z

I will take a look at the aleph branch in the next couple of days.

2021-02-02T06:46:16.027500Z

In the near future, do you plan to maintain both branches master and aleph or do you plan to replace master when you can?

noprompt 2021-02-02T06:46:54.028300Z

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

noprompt 2021-02-02T06:47:07.028600Z

No, I would want stick with aleph after.

noprompt 2021-02-02T06:47:26.029100Z

I always support accepting patches, etc though.

2021-02-02T06:48:58.030Z

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.

2021-02-02T06:49:30.030500Z

Communicate on the direction of the project so that people can be side by side with you.

2021-02-02T06:50:22.031100Z

Small detail: the git branch is spelled alef , not aleph

noprompt 2021-02-02T06:50:29.031300Z

LOL

noprompt 2021-02-02T06:50:55.031800Z

My mistake 🙂

noprompt 2021-02-02T06:51:01.032100Z

I certainly mean that

noprompt 2021-02-02T06:51:44.033100Z

Re: communication: I’ve mentioned needing help on main README.

2021-02-02T06:52:27.034500Z

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.

2021-02-02T06:53:03.035700Z

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.

noprompt 2021-02-02T06:53:27.036200Z

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.

noprompt 2021-02-02T06:54:17.037100Z

The reason is that between the things I enumerated earlier which occupy my time and mind is a head in the clouds.

noprompt 2021-02-02T06:54:51.037700Z

tl;dr I’m happy to help here and also in DMs

2021-02-02T06:55:48.038800Z

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.

noprompt 2021-02-02T06:56:13.039700Z

Young kids take a lot of input 🙂

2021-02-02T06:56:15.039800Z

I might have time next week to look at alph and see what I can do on it.

noprompt 2021-02-02T06:56:17.040Z

I have 3 😛

2021-02-02T06:56:35.040400Z

You +1 me, I have 2

noprompt 2021-02-02T06:56:42.040600Z

Ha!

noprompt 2021-02-02T06:57:27.041700Z

Any number of kids beyond one is difficult

noprompt 2021-02-02T06:57:44.042200Z

I think someone said the difficulty is squared for each one you have 😄

noprompt 2021-02-02T06:58:18.042900Z

But I promise you, if you want to work on the project I will give you my full support

1👍
2021-02-03T04:20:36.047100Z

@noprompt I will cut a first release for Girouette first, then see how to improve Garden right after.

noprompt 2021-02-03T20:35:43.051900Z

Works for me. Keep in touch.

2021-02-02T06:58:25.043100Z

I would say it’s log if you can teach them to take care of each other.

noprompt 2021-02-02T06:58:43.043400Z

I look forward to that day. 🙂

noprompt 2021-02-02T07:03:18.044900Z

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

noprompt 2021-02-02T07:04:30.045800Z

You could create a separate step for finding the media queries and properly hoisting them to the top level as you suggested.