I have a simple Figwheel application which is built with Leiningen.
I want to have multiple pages in it:
- index.html should use the code from hello-figwheel.core.
- page2.html should use the code from hello-figwheel.page2
I assume I have to somehow modify the project.clj file:
: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]}}
How can I tell Leiningen to compile
hello-figwheel.core
toresources/public/js/compiled/hello_figwheel.js
andhello-figwheel.page2
toresources/public/js/compiled/page2.js
?
There is a similar question. The difference to this one is that Leiningen is used to run Figwheel.
Update 1: I added the following to the project.clj file:
{
: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"]}
}
When I run lein figwheel
, the REPL is unable to connect to my web application:
It says Prompt will show when Figwheel connects to your application
, but it never happens.
Also, if I open http://localhost:3449/page2.html
in the browser, update page2.cljs, and refresh the page in the browser, the changes are not visible there.