shadow-cljs 2025-03-14

How do I include a local javascript file?

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

Thanks I think I figured it out

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

hmm? you mean the one it generates?

not possible, by design

Like this one my_app__L5C16

Not possible to rename my_app?

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

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

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

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

would that be enough?

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

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

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

yeah dunno when I'll get to this

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

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

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

Ooh thanks you very much 🙏