This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-18
Channels
- # announcements (2)
- # architecture (10)
- # beginners (51)
- # cider (14)
- # cljsrn (1)
- # clojure (13)
- # clojure-uk (3)
- # clojurescript (63)
- # cursive (1)
- # datomic (8)
- # emacs (1)
- # figwheel (1)
- # figwheel-main (18)
- # fulcro (62)
- # hyperfiddle (1)
- # incanter (1)
- # jobs-discuss (4)
- # off-topic (3)
- # parinfer (6)
- # reagent (5)
- # ring-swagger (3)
- # shadow-cljs (25)
- # sql (2)
- # tools-deps (2)
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 https://github.com/weavejester/environ 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
[here](https://figwheel.org/docs/your_own_page.html) 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:
https://figwheel.org/config-options#open-url
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.
@euccastro you do not want to have two versions of the same namespace behave differently.
@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