Thanks for this, Gary!

I was able to figure out a workable solution 
<https://github.com/ethagnawl/clojurescript-vim-fireplace-demo>, but this 
is useful information and your repository is a nice template for new 
projects. I haven't gotten around to trying to do a production build of my 
demo application just yet, but I'll probably refer back to your example 
when I do.

Pete

On Thursday, June 4, 2020 at 10:52:14 AM UTC-4, Gary Johnson wrote:
>
> Hi Pete,
>
> I haven't worked with the CLJS Webpack guide recently, but getting 
> Clojurescript and Figwheel to work together is pretty straightforward in my 
> experience.
>
> I use the standard *clojure* build tool from here: 
> https://clojure.org/guides/getting_started
>
> When run from the command prompt, *clojure* reads a deps.edn file in the 
> same directory. Here's an example of its contents for a basic web 
> application:
>
> *deps.edn*
> {:paths ["src/clj" "src/cljs" "resources" "target"]
>
>  :deps {org.clojure/clojure       {:mvn/version "1.10.1"}
>         org.clojure/clojurescript {:mvn/version "1.10.597"}
>         org.clojure/core.async    {:mvn/version "1.1.587"}
>         org.clojure/data.json     {:mvn/version "1.0.0"}
>         org.clojure/data.xml      {:mvn/version "0.0.8"}
>         ring/ring                 {:mvn/version "1.8.0"}
>         ring/ring-defaults        {:mvn/version "0.3.2"}
>         hiccup/hiccup             {:mvn/version "2.0.0-alpha2"}
>         reagent/reagent           {:mvn/version "0.10.0"}}
>
>  :aliases {:compile-cljs {:main-opts ["-m" "cljs.main" "-co" 
> "compile-prod.cljs.edn" "-c"]}
>            :run-server   {:main-opts ["-m" "my-project.server"]}
>            :figwheel     {:extra-deps {com.bhauman/figwheel-main 
> {:mvn/version "0.2.4"}
>                                        com.bhauman/rebel-readline-cljs 
> {:mvn/version "0.1.4"}}
>                           :main-opts ["-m" "figwheel.main" "-b" 
> "compile-dev" "-r"]}}}
>
>
> This file provides three custom aliases: compile-cljs, run-server, 
> figwheel.
>
> You can run any them like so:
>
> $ clojure -A:figwheel
>
> Each of these aliases references additional build files. So here they are 
> for your reference:
>
> *compile-dev.cljs.edn*
> {:main          "my-project.client"
>  :output-dir    "target/public/cljs/out"
>  :output-to     "target/public/cljs/app.js"
>  :asset-path    "/cljs/out"
>  :source-map    true
>  :optimizations :none
>  :pretty-print  true}
>
> *compile-prod.cljs.edn*
> {:main            "my-project.client"
>  :output-dir      "target/public/cljs"
>  :output-to       "target/public/cljs/app.js"
>  :source-map      "target/public/cljs/app.js.map"
>  :optimizations   :advanced
>  :pretty-print    false
>  :closure-defines {"goog.DEBUG" false}}
>
> *figwheel-main.edn*
> {:watch-dirs ["src/cljs"]
>  :css-dirs ["resources/public/css"]
>  :ring-server-options {:port 8080 :join? false}
>  :ring-handler my-project.handler/development-app}
>
> With these files in place, you should be all set to start building your 
> web application. You need to create *my-project.server/-main* (to start 
> the web server), *my-project.handler/development-app* (to be your ring 
> handler function), and *my-project.client* (to be the entrypoint file for 
> your CLJS code). Everything else is up to you.
>
> I created a repository awhile ago containing a web application template 
> with all of these files and a good deal of default code to get you going. 
> You can find it here:
> https://gitlab.com/lambdatronic/clojure-webapp-template
>
> Have fun and happy hacking!
> ~Gary
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojurescript/3c034e01-d8ea-44bd-91c6-e344c1c11ec1o%40googlegroups.com.

Reply via email to