Fork me on GitHub

how would you implement logic differences between development and production in a figwheel-main/tools-deps project? for example, I have a website with multiple pages, some of which contain no JS at all. in development I still want to send my main.js to those pages so I get CSS reloading. in production I don't want to load any .js unless necessary


I can think of a number of ways to do it, but I wonder if there's some idiomatic solution


one way would be to have :dev and :production tools.deps aliases with "dev" and "production" :extra-paths, and have some myproject.stage namespace defined in both, with different implementations reflecting the logic differences


another way would be to use and set an :in-development flag in Java system properties (again, in the :dev alias). then check for this flag whenever I want different behavior in dev vs production


any simpler ones (or any others you prefer for any reason)?


[here]( the docs mention running your own server alongside. How do I keep figwheel from opening localhost:9500, and only compile continuously to target dir so i can run my own server?


That page links to the documentation of the :open-url config option: that documentation starts as: > Either a boolean value false or a string that indicates the url that the figwheel REPL will open in the browser after the source code has been compiled. A false value will disable this behavior.


Thanks, this is it :)


@euccastro you do not want to have two versions of the same namespace behave differently.


what you want is to use goog-define along with :closure-defines


@bhauman but that is clojurescript-only, right? I'd rather not have two different systems for clj vs cljs


Then you will need to forward the environ variable to the :closure-defines in a script


but :closure-defines is the very best way to do things conditionally in CLJS


everything else is prone to problems


the different paths thing can certainly work though, I’m still stuck thinking about working with leiningen and cljsbuild and lein figwheel. Having a conditional path to a namespace didn’t work very well because you had less control over what the plugin does to the classpath.