Fork me on GitHub
#babashka
<
2023-01-10
>
Mikko Harju18:01:31

Any suggestions on what to use for "templating" – I would need to generate files from a given template, applying contents from an env – so basically something Django, Jinja2 etc do, but for non-html -stuff

pavlosmelissinos18:01:37

https://github.com/yogthos/Selmer is used mostly for html but it supports any text

Mikko Harju18:01:58

Thanks for the tip!

borkdude18:01:13

and this is built-in to bb

😎 4
2
pavlosmelissinos18:01:00

Oh, good to know! For very simple string interpolation with Clojure (a la Python's fstrings) there's also clojure.core.strint/<< https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/strint.clj#L49-L76 , which I've found interesting but unappreciated

😎 2
borkdude18:01:02

There is also format ;)

2
borkdude18:01:34

I sometimes also use (str/replace "foo {{bar}}" "{{bar}}" "123") ;)

💡 2
pavlosmelissinos18:01:29

Well, sure, format is very handy but the semantics are slightly different (compared to strint/<<, which can "absorb" the transformations)

Mikko Harju18:01:31

That's what i've been mostly using for basic stuff

Mikko Harju18:01:42

can one use camel-snake-kebab easily with bb? I know there must be docs on that but since you're here I might as well ask 😄

borkdude18:01:24

@U32ST9GR5 Yes, if you add this dependency in bb.edn (similar to how you use deps.edn)

Mikko Harju18:01:27

{:deps {..}} or..?

borkdude18:01:09

youre_welcome

😎 2