                      tempf))
         cfg (-> cfg
                 (cond->
-                    temp-dir (assoc-in [:options :output-dir] (default-output-dir temp-dir))
-                    temp-dir (assoc-in [:options :output-to]  (default-output-to temp-dir))
+                    temp-dir (assoc-in [:options :output-dir]
+                                       (default-output-dir* temp-dir))
+                    temp-dir (assoc-in [:options :output-to]
+                                       (default-output-to* temp-dir))
                     temp-dir (assoc-in [:options :asset-path]  "cljs-out"))
                 (assoc-in [:options :aot-cache] false)
                 (update :options #(assoc % :main

;; Config
;; ----------------------------------------------------------------------------

(defn default-output-dir [target & [scope]]
  (->> (cond-> [(or target "target") "public" "cljs-out"]
         scope (conj scope))
       (apply io/file)
       (.getPath)))

(defn default-output-to [target & [scope]]
  (.getPath (io/file (or target "target") "public" "cljs-out"
                     (cond->> "main.js"
                       scope (str scope "-")))))

(defn extra-config-merge [a' b']
  (merge-with (fn [a b]

(defn- config-default-dirs [{:keys [options ::config ::build] :as cfg}]
  (cond-> cfg
    (nil? (:output-to options))
    (assoc-in [:options :output-to] (default-output-to cfg))
    (nil? (:output-dir options))
    (assoc-in [:options :output-dir] (default-output-dir cfg))))

(defn figure-default-asset-path [{:keys [figwheel-options options ::config ::build] :as cfg}]

  (if (= :nodejs (:target options))
    (:output-dir options)
    (let [{:keys [output-dir]} options]
      ;; TODO could discover the resource root if there is only one
      ;; or if ONLY static file serving can probably do something with that
      ;; as well
      ;; UNTIL THEN if you have configured your static resources no default asset-path
      (when-not (contains? (:ring-stack-options figwheel-options) :static)
        (let [parts (fw-util/relativized-path-parts (or output-dir
                                                        (default-output-dir cfg)))]
          (when-let [asset-path
                     (->> parts
                          (split-with (complement #{"public"}))
                          last
                          rest
                          not-empty)]
            (str (apply io/file asset-path))))))))

;; targets options
(defn- config-default-asset-path [{:keys [options] :as cfg}]
