0

I have a simple Figwheel application which is built with Leiningen.

I want to have multiple pages in it:

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 to resources/public/js/compiled/hello_figwheel.js and
  • hello-figwheel.page2 to resources/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:

lein figwheel

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.

Glory to Russia
  • 17,289
  • 56
  • 182
  • 325

0 Answers0