Fork me on GitHub
#garden
<
2019-02-26
>
aisamu05:02:59

Hey! Is there a less-hacky way to achieve this?

.parent {
  color: red;
}
.parent > .child {
  margin: 0;
}
The best I could get was:
(garden.core/css
 [:.parent {:color 'red}
  [(gs/& :> :.child)
   {:margin 0}]])

.parent {
  color: red;
}
.parent>.child {
  margin: 0;
}
Also, I'd love some pointers on what's wrong with my mental model on the initial attempt:
(garden.core/css
 [:.parent {:color 'red}
  [(gs/> (gs/&) :.child)
   {:margin 0}]])

.parent {
  color: red;
}
.parent & > .child {
  margin: 0;
}

niamu05:02:22

@aisamu Does this feel less “hacky” to you?

[:.parent {:color :red}
 [:&> [:.child {:margin 0}]]]

simple_smile 5
aisamu05:02:19

It's definitely prettier and fixes half of the whitespace weirdness, thanks! (`.parent> .child`)

aisamu05:02:20

It's still a bit conceptually hazy, though.

niamu05:02:20

which part is hazy for you?

aisamu13:02:06

I was expecting something more explicit (e.g. (gs/> :& :.child)) Your solution definitely profits from garden's execution model and CSS whitespace behavior, but that can also be seen as conceptual "overhead" for newcomers!

noprompt22:02:19

I’d be interested to hear alternative approaches or ways that’d help reduce that overhead. Keep in mind that Garden is not a priority for me currently and I’m pretty much open to working with anyone on any PR that’d improve the landscape.