Fork me on GitHub
#garden
<
2021-02-02
>
Vincent Cantin05:02:47

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

Vincent Cantin05:02:20

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

Vincent Cantin05:02:16

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

noprompt06:02:19

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

noprompt06:02:00

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

Vincent Cantin06:02:23

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.

noprompt06:02:39

Oh man would I love help

noprompt06:02:00

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

noprompt06:02:45

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

Vincent Cantin06:02:00

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

noprompt06:02:01

Apologies if I sound desperate! 🙂

Vincent Cantin06:02:44

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

noprompt06:02:50

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

noprompt06:02:44

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.

noprompt06:02:43

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.

noprompt06:02:27

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)

noprompt06:02:55

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

Vincent Cantin06:02:29

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

noprompt06:02:19

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

noprompt06:02:39

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

Vincent Cantin06:02:06

Your goal is not to have dependencies ?

noprompt06:02:42

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

noprompt06:02:48

Yes, no dependencies.

noprompt06:02:59

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

noprompt06:02:07

It’s way easier. 🙂

noprompt06:02:20

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

noprompt06:02:49

Basically pulling the media query up.

Vincent Cantin06:02:02

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

Vincent Cantin06:02:16

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

noprompt06:02:54

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

noprompt06:02:07

No, I would want stick with aleph after.

noprompt06:02:26

I always support accepting patches, etc though.

Vincent Cantin06:02:58

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.

Vincent Cantin06:02:30

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

Vincent Cantin06:02:22

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

noprompt06:02:55

My mistake 🙂

noprompt06:02:01

I certainly mean that

noprompt06:02:44

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

Vincent Cantin06:02:27

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.

Vincent Cantin06:02:03

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.

noprompt06:02:27

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.

noprompt06:02:17

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

noprompt06:02:51

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

Vincent Cantin06:02:48

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.

noprompt06:02:13

Young kids take a lot of input 🙂

Vincent Cantin06:02:15

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

noprompt06:02:17

I have 3 😛

Vincent Cantin06:02:35

You +1 me, I have 2

noprompt06:02:27

Any number of kids beyond one is difficult

noprompt06:02:44

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

noprompt06:02:18

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

👍 1
Vincent Cantin04:02:36

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

noprompt20:02:43

Works for me. Keep in touch.

Vincent Cantin06:02:25

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

noprompt06:02:43

I look forward to that day. 🙂

noprompt07:02:18

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

noprompt07:02:30

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