2016-03-30 9 views
1

私のclojurescriptコードのproject.cljは:repl-options {:init-ns my-project.core}と指定し、start-figwheel!でfigwheelを開始します。 figwheel documentationではfigwheelの起動時figwheelをカスタム初期名前空間で始めるにはどうすればいいですか?

;; you can also just call (ra/start-figwheel!) 
;; and figwheel will do its best to get your config from the 
;; project.clj or a figwheel.edn file` 

しかし、それはcljs.user名前空間に私を置くことを言います。 figwheelがこのオプションを選ぶにはどうすればいいですか?次のように

私figwheel.cljに見えます:

(require '[figwheel-sidecar.repl :as r] 
     '[figwheel-sidecar.repl-api :as ra]) 

(ra/start-figwheel! 
    {:figwheel-options {} 
    :build-ids ["dev"] 
    :all-builds 
    [{:id "dev" 
    :figwheel {:devcards true} 
    :source-paths ["src"] 
    :compiler {:main 'my-project.core 
       :asset-path "js" 
       :output-to "resources/public/js/main.js" 
       :output-dir "resources/public/js" 
       :verbose true}}]}) 

(ra/cljs-repl) 

私は基本的に、Googleのグループからthis questionを求めています。

+0

外部REPLクライアントから 'lein repl -c'を使って接続したり、'(ra/start-figwheel) 'を実行しているのと同じREPLに名前空間を変更していませんか? –

+0

私はfigwheel.cljを追加しました。私は私のブラウザに接続しています。そして、私がスクリプトを起動した端末にreplプロンプト( 'cljs.user'と一緒に)が現れます。私は 'lein repl:connect 3449'を試みましたが、これはちょうど掛かっていました。 – synthetic

+0

':repl-options'は、figwheel自身ではなく、leinのreplタスクによってのみ使われると思います。あなたの 'figwheel.clj'はどうやって使うのですか?それをスクリプトとして実行するか、またはREPLセッションでロードしますか? –

答えて

0

start-figwheel!は、図形ロジックを開始します。あなたの発見についてということ:

;; you can also just call (ra/start-figwheel!) 
;; and figwheel will do its best to get your config from the 
;; project.clj or a figwheel.edn file` 

それは確かにその設定を見つけたが、it's only :figwheel submap of project.clj

:repl-optionsは、起動時にREPLによって使用されます。 figwheel-sidecar.repl-api/cljs-replはREPLオプションを指定することができず、project.cljからそれらを読み取らないようです。

あなたは、スタンドアロンスクリプトの代わりに実行したいコードを提供するために、lein repl project.cljの:repl-options使用:initオプションを起動して再生しようとするかもしれません。

+0

関連するfigwheelコードを掘り下げてくれてありがとうPiotrek!要約すると、figwheelのrepl APIからreplを開始する代わりに、私はleinのrepl機能を使用して、figwheelコードを(project.cljの ':init'オプションを介して)ロードします。 – synthetic

+0

はい、うまくいくと思います。 –

+0

私は、 'start-figwheel!'(と 'require'コード)を':init'の 'do'サンクに入れ、ソースファイルを見つけることができないので動作しませんでした。私は '' init''がこのためのものではないという気持ちも得ています。ですからfigwheelにはproject.cljから ':repl-options'を取得するための機能がないというあなたの答えは正しいですが、私たちができることはあまりないようです。 – synthetic

関連する問題