Fork me on GitHub
#garden
<
2020-04-09
>
ag22:04:53

can someone help me to write this one in Garden:

.links a:not(:first-child)

noprompt22:04:54

(require '[garden.selectors :as $])

[:.links ($/a ($/not $/first-child)) ,,,] 

noprompt22:04:34

Keep in mind you can always write selectors with strings.

noprompt22:04:11

[".links" "a:not(:first-child)" ,,,]

noprompt22:04:36

You can use the stuff in the garden.selectors too.

ag22:04:35

oh… cool. I gotta say: so many times I wanted to try Garden, but for various reasons I couldn’t do it at work. Finally for my personal project I picked it up and I was almost immediately amazed how awesome it is.

noprompt22:04:27

I’m glad you enjoy it. I’ve been lagging on making the next version available because I’ve been busy working on #meander.

noprompt22:04:33

Its nice to hear folks still find the current version useful enough.

ag22:04:40

Since you already here, can you tell me how to do something with repeated properties, something like this:

background: #FFFDF2; /* Old browsers */
  background: -moz-linear-gradient(left,  #FFFDF2 0%, #FFFDF2 37%, #ffffff 100%); /* FF3.6+ */
  background: -webkit-gradient(linear, left top, right top, color-stop(0%,#FFFDF2), color-stop(37%,#FFFDF2), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
  background: -webkit-linear-gradient(left,  #FFFDF2 0%,#FFFDF2 37%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
  background: -o-linear-gradient(left,  #FFFDF2 0%,#FFFDF2 37%,#ffffff 100%); /* Opera 11.10+ */
  background: -ms-linear-gradient(left,  #FFFDF2 0%,#FFFDF2 37%,#ffffff 100%); /* IE10+ */
  background: linear-gradient(to right,  #FFFDF2 0%,#FFFDF2 37%,#ffffff 100%); /* W3C */
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFDF2', endColorstr='#ffffff',GradientType=1 ); /* IE6-9 */
I figured out how to do linear-gradients, but not sure how to do something like this

noprompt22:04:43

I’ve had a ton of fun with it.

noprompt22:04:05

For repeated properties you just use more maps.

ag22:04:49

Absolutely. It’s so nice to have a real turing-complete awesome language instead of a pre-processor. I’m just having so much fun. Thank you for this awesomeness.

noprompt22:04:50

[some-selector
  {:background background1}
  {:background background2} ,,,]

ag22:04:02

Awesome! Thank you!

noprompt22:04:04

The dream I had for the next version of garden was to be able to also consume and manipulate existing CSS style sheets in a uniform way.

noprompt22:04:34

So the “syntax” we have now would just be converted to a common CSS AST.

noprompt22:04:46

Then you just manipulate the AST.

noprompt22:04:23

This would basically give you the same power as PostCSS but, you know, with Clojure instead of JavaScript.

ag22:04:56

That would be absolutely dope. One of the reasons (if I remember it right) why we couldn’t use Garden - because of the existing sass mixins we were forced to use

noprompt22:04:27

Yeah. I’ve heard (and respect) that rationale over the years.

noprompt22:04:16

This was more or less one of the things that pushed me toward working on #meander.

noprompt22:04:31

It’d be nice to have a common AST format in Clojure.

noprompt22:04:51

I’ve gotta step away now. If you have more questions, ask here, etc. Myself or someone will help.

noprompt22:04:09

I just noticed your question in #css, sorry for not replying there!

ag22:04:14

I love Meander, although haven’t used it much.

ag22:04:05

> I just noticed your question in #css, sorry for not replying there! no worries. it wasn’t blocking me. but the :not selector was. Thank you again

noprompt22:04:27

In the summer time there’ll be a new release of Meander that addresses many of the current limitations. It’ll have aggregation super powers, the ability to query/parse strings and byte streams using pattern matching. I’m really excited about it.

👀 4
ag22:04:46

oh wow.

noprompt22:04:06

With it, anyone could build something like Garden very quickly.

noprompt22:04:31

We have an example of how to compile Hiccup but its not as clean as I would like.

noprompt22:04:30

OK, now I need to step away for real. 😛

ag23:04:19

Sorry I got a phone call. Thank you again for your help!

👍 4