Fork me on GitHub
#cljsrn
<
2017-05-20
>
kurt-o-sys06:05:51

@carocad Not sure. They're not really global-vars. It's more about parameters to set on compile time.

kurt-o-sys06:05:19

Did anyone manage to use closure-defines with re-natal (when running lein figwheel android)? I can't seem to manage, following https://www.martinklepsch.org/posts/parameterizing-clojurescript-builds.html and https://github.com/drapanjanas/re-natal/issues/46 .

vikeri06:05:58

@seantempesta Great! So to be clear, I can switch tabs by dispatching to a reframe handler?

kurt-o-sys07:05:17

@vikeri did you get closure-defines to work? (About a year ago, you didn't 🙂 ) > vikeri: Is there something special with :closure-defines in regard to re-natal? Can’t get it to work...

kurt-o-sys07:05:40

ok, thx... no config in lein, and just taking environmental variables?

vikeri07:05:10

Actually I’m using boot. So I don’t know how it would work in lein…

kurt-o-sys07:05:13

right... cljsrn and boot works well? (I usually don't use lein, but I did for my first cljsrn project)

kurt-o-sys07:05:39

so you set your environment in build.boot?

vikeri07:05:39

@kurt-o-sys Unfortunately brn reloading does not work with newer version of RN. So I’ve hacked together a mix of brn and re-natal (using the figwheel setup from re-natal but everything else from boot). Exactly I set them in build.boot.

vikeri07:05:14

But since boot-figwheel is not part of the fileset it won’t pick up those changes. So I had to write this helper macro

kurt-o-sys07:05:45

ok... makes kinda sense. Will try with lein 🙂

vikeri07:05:30

And then I define my default variables like this:

vikeri07:05:41

(macros/generate-envs {"ENVIRONMENT"     "test"
                       "VAR2"     "1"
                      })

vikeri07:05:08

It pretty sweet to have access to the variables both in clj (eg. macro) and cljs land.

kurt-o-sys09:05:11

@vikeri Got it working, a little bit different, but still, it looks ok to me (deciding on build time which config to use): $ CONFIG=$(cat config/dev.edn) lein figwheel android

kurt-o-sys09:05:23

Fairly simple and easy to read - well the CONFIG environment varialble is actually MYAPP_CONFIG. Thx again.

kurt-o-sys09:05:10

... and in my code: (env/def MYAPP_CONFIG nil) and something like (configure (cljs.reader/read-string FLEEMAN_CONFIG))

vikeri10:05:53

@qsys good stuff!