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
<http://dev.internal.se|dev.internal.se> <http://dev.internal.se/api|dev.internal.se/api>
<http://prod.com|prod.com> <http://api.prod.com|api.prod.com>
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@saikyun Maybe use Selmer to have mostly static templates with a few variables substituted?
@seancorfield thanks for the tip! I'll check it out 🙂 definitely seems to do what I want to do 🙂
We use Selmer very heavily at work to generate HTML pages from templates and data.
cool 🙂 did I understand Selmer correctly, that it doesn't re-generate html pages if the data hasn't changed?
sounds very useful
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.
(we use it to generate all the emails we send, as well as all the HTML pages we generate from several apps)
aha, cool. we're nowhere that amount, so that's reassuring 🙂
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 🙂