Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ease usage of :active-profiles #679

Open
thatismatt opened this issue Apr 18, 2018 · 0 comments
Open

Ease usage of :active-profiles #679

thatismatt opened this issue Apr 18, 2018 · 0 comments

Comments

@thatismatt
Copy link
Contributor

I've just happened upon a workaround for getting lein profiles working from nrepl. My usecase is multiple figwheel "instances" within one lein project. I thought it was useful enough to share.

project.clj

 ... 8< ...

  ;; defaults
  :figwheel {:server-port  3449 ... }

  ;; overrides for foo
  :profiles {:foo {:figwheel {:server-port 3447 ... }}}

 ... 8< ...

 :cljsbuild
  {:builds
   [;; default - bar
    {:id"bar-build-id" ...}
    ;; foo
    {:id"foo-build-id" ...}]}

 ... 8< ...

dev/user.clj

(ns user
  (:require [figwheel-sidecar.repl-api :as f]
            [figwheel-sidecar.config :as fc]
            [simple-lein-profile-merge.core :as lm]))

(def foo-profiles
  (conj lm/default-profiles :foo))

(defn fetch-foo-config
  []
  (assoc (fc/initial-config-source)
         :active-profiles foo-profiles))

(defn start-foo-figwheel!
  []
  (f/start-figwheel!
   (fetch-foo-config)
   "foo-build-id"))

It might also be nice to extend start-figwheel! to accept additional profiles to be merged in, so that the above could be simplified to something like:

(f/start-figwheel! "foo-build-id" :profiles [:foo])

If this is of interest, let me know and I'll look in to putting a PR together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant