Fork me on GitHub
#shadow-cljs
<
2022-04-17
>
lilactown20:04:08

is there a way to add custom CSS to the browser REPL and have it hot reload?

👀 1
victorb20:04:28

The browser devtools should reload it for you automagically when it changes on disk, if you use the built-in server and whatnot

lilactown20:04:06

I'm asking about using the browser REPL, rather than configuring a build

lilactown20:04:19

I know how to configure a build with my own index.html that includes my CSS. I would like to avoid that for a simple project, and just include the CSS in the default browser REPL page

victorb20:04:02

I see. Seemingly, it won't know if files on disk has changed unless you have some devtool connection between the browser and the clojure process that shadow-cljs runs its builds from. Would be a lot of additional setup to get that running.

victorb20:04:28

You could manually remove/add link tags in your DOM I guess and point it to the CSS file on disk, trigger that action on change somehow

victorb20:04:00

I don't think you need any fancy "hot reload" but can simply reload the entire file at once without any concern

lilactown00:04:02

I wonder how shadow-cljs reloads the CSS. is it just adding/removing the link tags?

thheller05:04:17

browser-repl doesn't allow custom css currently

thheller05:04:06

but browser-repl is nothing but a regular :browser build so technically it would be easy to add. there just aren't any options for it

thheller05:04:17

thats the html being served

thheller05:04:54

thats the build config used

lilactown16:04:19

thanks! this doesn't directly solve my problem, but I've been thinking about how to build better tools for doing REPL driven UI development and this gives me more to chew on (how to add & dynamically reload CSS)

victorb20:04:25

Can I change the location of shadow-cljs.edn somehow? Search around both in the docs, on the web and in the code base for any parameter/environment variable that allows me to point it to a different one