Fork me on GitHub
#css
<
2016-02-23
>
grounded_sage10:02:59

#channel Could I ask for some quick help from anyone using Garden. I am trying to use pseudo elements. When I do this (defpseudoelement after) and run this (css [:body after {:background 'blue}]) in the repl I get back this "body, ::after {\n background: blue;\n}". Not sure how to stop the comma from after body.

niamu14:02:15

@grounded_sage: (defselector body) (defpseudoelement after) (css [(body after) {:background 'blue}])

niamu14:02:53

I think that should work.

grounded_sage14:02:24

@niamu: I'll give that a go. I tried it earlier after reading the source and followed the (defselector p) example and it didn't work for me 😞

niamu14:02:17

You may also be able to do something like (css [body [:&:after {:background ‘blue}]]) It’s not exactly correct but I think every browser will render that correctly.

niamu14:02:19

And then there’s always (css [“body::after” {:background ‘blue}])

niamu14:02:12

I usually just end up going with the strings with garden just because I can’t be bothered to bring in the other namespaces to compose the more complicated selectors when I generally don’t need the flexibility beyond one or two styles. Feels like a lot of overhead for me personally.

grounded_sage14:02:04

Yes I agree. Saw string version and was like THATS IT. But wanted to see if the first one you gave me worked which it did... so must have been something else I was doing.

grounded_sage14:02:15

I didn't think it would unstring the string so I was using (read-string (str ...)) which was just keeping the function as is and not evaluating it lol.

niamu14:02:22

The strings don’t really make me feel great, but at least I’m in and out quickly and I can move on to the next style rather than pausing and realizing I need to pull in another piece of garden before I can continue.

grounded_sage14:02:43

Yep I know the feeling. I decided to build my static site using all of this plus following Atomic Design principles which has resulted in a bucket load of namespaces. Way overkill but I am learning!