Fork me on GitHub

What's the best way to update a value in an EDN file with babashka? I have a figwheel-main.edn config which looks like this:

;; See 
;; and 

;; overriding default index.html page - we need to serve home.html from the server
{:open-url ":[[server-port]]/app" ;  ;; set target-dir different than "target" - see 
 :target-dir "resources"
 :css-dirs ["resources/public/css"] ; 
 :watch-dirs ["src/cljc" "src/cljs" "env/dev/cljs"] ; 
I need to parse port value from another edn file and replace [[server-port]] in figwheel-main.edn with this value. Ideally, I want to preserve all the comments and whitespaces. Should I just use sed ? 🙂

oxalorg (Mitesh)12:03:20

But for such a simple usecase just use str/replace and bit of regex!


or just slurp, str/replace + spit


Perfect, thanks!