shadow-cljs

Eva O 2025-03-14T12:03:55.643259Z

How do I include a local javascript file?

thheller 2025-03-14T12:04:41.664849Z

the answer kinda depends on what kind of JS file it is

Eva O 2025-03-14T12:22:02.858299Z

Thanks I think I figured it out

J 2025-03-14T16:36:49.927079Z

Hi guys! In shadow-css, how override the default css classname?

thheller 2025-03-14T16:37:17.651729Z

hmm? you mean the one it generates?

J 2025-03-14T16:38:34.353559Z

Yep

thheller 2025-03-14T16:38:45.744429Z

not possible, by design

J 2025-03-14T16:39:32.782599Z

Like this one my_app__L5C16

J 2025-03-14T16:39:53.718589Z

Not possible to rename my_app?

thheller 2025-03-14T16:40:20.952089Z

no, the suffix is line 5 column 16 to aid debugging, which also makes it unique so that multiple css uses in the same file do not conflict

J 2025-03-14T16:41:45.919129Z

The line and column is ok, I would like rename just the prefix my_app to have for example my_override_app_L5C16

thheller 2025-03-14T16:44:09.957219Z

that is currently not possible in this version of the library. my earlier attempts of css-in-cljs allowed specifying this alias via metadata on the ns, so you'd have (ns {:shadow.css/alias "foo"} (:require ...)) and that would make the macro generate foo_L5C16 instead using using the ns by default

thheller 2025-03-14T16:44:45.733049Z

I wouldn't be opposed to supporting this again, but so far I never had the need

thheller 2025-03-14T16:45:06.506849Z

would that be enough?

thheller 2025-03-14T16:46:03.392659Z

problem is that the css macro needs access to this alias as well as the build tooling. given they are separate processes there aren't too many places to put this

J 2025-03-14T16:48:01.896229Z

{:shadow.css/alias "foo"} will be perfect

J 2025-03-14T16:52:09.293899Z

But for the moment I can create a separate namespace with the desired name that hold all my styles

thheller 2025-03-14T17:14:15.524709Z

yeah dunno when I'll get to this

thheller 2025-03-14T17:14:46.999829Z

there is also a more ambitious version planned that lets you replace the names entirely via the build tooling, but thats just a rough concept at this point

thheller 2025-03-15T21:26:09.459499Z

added this in 0.6.0, so (ns {:shadow.css/alias "foo"} (:require ...)) will generate foo_LxCx now

thheller 2025-03-15T21:26:52.092799Z

there is no guard against any kind of conflicts though, so make sure different namespaces dont use the same alias

J 2025-03-15T21:50:58.704009Z

Ooh thanks you very much 🙏