This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-05
Channels
- # aleph (1)
- # announcements (1)
- # babashka (6)
- # beginners (25)
- # biff (6)
- # calva (61)
- # clojure (15)
- # clojure-europe (2)
- # clojurescript (34)
- # cursive (7)
- # events (2)
- # figwheel-main (5)
- # fulcro (10)
- # gratitude (1)
- # malli (2)
- # pathom (1)
- # polylith (3)
- # portal (1)
- # re-frame (3)
- # reagent (10)
- # releases (2)
- # shadow-cljs (19)
- # spacemacs (5)
- # xtdb (2)
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
? 🙂I have a demo doing something similar: https://www.youtube.com/watch?v=b7NPKsm8gkc
But for such a simple usecase just use str/replace and bit of regex!