Fork me on GitHub
#clojurescript
<
2021-08-09
>
Richard Bowen04:08:30

How does one reference the ::before selector using Reagent?

Asko Nōmm05:08:33

Afaik, Reagent creates inline styles and pseudo-selectors cannot be targeted via inline styles.

Richard Bowen05:08:52

I see. Thanks.

sansarip13:08:36

If you want to apply css styles programmatically with cljs, you can do so conveniently with a tool like https://github.com/roosta/herb 🌿 or https://github.com/dhleong/spade ♠️ - both use https://github.com/noprompt/garden :female-farmer: syntax

Jonas17:08:44

Hey all, I'm trying to compile a clojurescript form within clojurescript, by defining a macro in a .clj file

(ns my-worker.helpers
  (:require [cljs.closure :as cljs]))
(defmacro compile-cljs [form] (cljs/build [form] {:optimizations :simple :pretty-print true}))
and then calling it from my .cljs file
(def x (helpers/compile-cljs '[
                              (.log js/console "hello")]))
while this def would work totally fine in the .clj file, it fails in the clojurescript file with the message
; clojure.lang.ExceptionInfo: Namespace declarations must appear at the top-level. at line 9
Why does that happen?

dpsutton19:08:25

had a coworker require [cljs.js :as js] because he was using js/JSON. Wanted to ask questions about that. I know it is unnecessary, but is it really even allowed? I thought the namespace js was special and the compiler did its thing so i'm surprised it allowed an alias of that

dnolen20:08:48

@dpsutton hrm I suppose we could warn

dnolen20:08:27

because any such alias will always be shadowed

dpsutton20:08:39

ok i thought that was my understanding

dpsutton20:08:05

awesome. thanks @dnolen

dnolen20:08:54

@ottenjonas not sure what you are attempting - if that could work x would be a string

Jonas20:08:55

yes that's what I want! (just using the def as an example here, but basically want to compile a form at compile time to js)

Jonas15:08:33

it interestingly enough works totally fine when I use the macro as a top-level form

(ns my-worker.core)

(helpers/compile-cljs '[(.log js/console "hello")])
but with the example I mentioned it throws the error

Jonas19:08:39

is there a reason why an error would not happen on the top-level form?