0

我有一个用 Leiningen 构建的简单 Figwheel应用程序。

我想在其中有多个页面:

我假设我必须以某种方式修改project.clj文件:

:compiler {:main hello-figwheel.core
           :asset-path "js/compiled/out"
           :output-to "resources/public/js/compiled/hello_figwheel.js"
           :output-dir "resources/public/js/compiled/out"
           :source-map-timestamp true
           ;; To console.log CLJS data-structures make sure you enable devtools in Chrome
           ;; https://github.com/binaryage/cljs-devtools
           :preloads [devtools.preload]}}

我怎样才能告诉 Leiningen 编译

  • hello-figwheel.coreresources/public/js/compiled/hello_figwheel.js
  • hello-figwheel.page2resources/public/js/compiled/page2.js

有一个类似的问题。与此不同的是,Leiningen 用于运行 Figwheel。

更新 1:我在project.clj文件中添加了以下内容:

{
                :id "page2"
                :source-paths ["src"]
                :compiler {
                           :output-dir "resources/public/js/compiled/page2"
                           :output-to "resources/public/js/compiled/page2/main.js"
                           :main hello-figwheel.page2
                           :asset-path "js/compiled/out"
                           :source-map-timestamp true
                           ;; To console.log CLJS data-structures make sure you enable devtools in Chrome
                           ;; https://github.com/binaryage/cljs-devtools
                           :preloads [devtools.preload]}

                :figwheel {:on-jsload "hello-figwheel.page2/on-js-reload"
                           ;; :open-urls will pop open your application
                           ;; in the default browser once Figwheel has
                           ;; started and compiled your application.
                           ;; Comment this out once it no longer serves you.
                           :open-urls ["http://localhost:3449/page2.html"]}
                }

当我运行lein figwheel时,REPL 无法连接到我的 Web 应用程序:

莱因无花果

它说Prompt will show when Figwheel connects to your application,但它永远不会发生。

此外,如果我http://localhost:3449/page2.html在浏览器中打开,更新page2.cljs并在浏览器中刷新页面,则更改在那里不可见。

4

0 回答 0