Fork me on GitHub

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


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


I think that should work.


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


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.


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


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.


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.


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.


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.


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!