Fork me on GitHub
#ring
<
2020-03-30
>
Saikyun05:03:31

how would one set some code from the http-server that is "injected" into my cljs-code? in my case I want to set an url to a server depending on which server my cljs-code is running from. like so:

server hosting cljs          rest api server
localhost                    localhost:1234
              
                     
right now I use ring and just serve static files. was thinking that maybe one could modify something in the files when ring sends the static files

seancorfield05:03:30

@saikyun Maybe use Selmer to have mostly static templates with a few variables substituted?

👌 4
Saikyun05:03:28

@seancorfield thanks for the tip! I'll check it out 🙂 definitely seems to do what I want to do 🙂

seancorfield05:03:32

We use Selmer very heavily at work to generate HTML pages from templates and data.

Saikyun05:03:23

cool 🙂 did I understand Selmer correctly, that it doesn't re-generate html pages if the data hasn't changed?

Saikyun05:03:26

sounds very useful

seancorfield05:03:45

It precompiles the templates (if I recall correctly), but it still generates the HTML each time -- but it's fast. We serve millions of pages a day with it.

seancorfield05:03:26

(we use it to generate all the emails we send, as well as all the HTML pages we generate from several apps)

Saikyun05:03:39

aha, cool. we're nowhere that amount, so that's reassuring 🙂

Saikyun05:03:18

decided to solve it using :closure-defines in shadow-cljs for now, but I'll probably need more than "environment variables" in the future. then I'll keep Selmer in mind 🙂