Fork me on GitHub
#boot
<
2020-09-24
>
neilyio14:09:57

My first day in boot, I love it so far! I'm going through https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-02.md, which recommends boot-reload, boot-cljs-repl, and boot-http. Are these still the recommended options? They don't seem very active. Is anyone using anything like Figwheel-main with boot?

simple_smile 5
borkdude15:09:48

@neil.hansen.31 If you are just starting out with CLJS #shadow-cljs might be a nice tool to get started with as well

borkdude15:09:30

Also #figwheel-main is cool, I'm using that a lot. I've never used it with boot though, only with #tools-deps

borkdude15:09:46

Shadow-cljs does work with boot, I've been told here before

neilyio15:09:22

Thanks @borkdude, I've been using shadow-cljs for a few months, and it was a great way to get started. I'm trying to write some CLJS integrations for the tools that my team uses (Next.js for static sites, StorybookJS for a component library), and I'm having a hard time getting a ClojureScript configuration. I was wondering if boot (or tools-deps) might provide me with a little more control over the CLJS output.

borkdude15:09:33

I personally prefer using cljs.main for maximum control. If you have issues they are going to ask you to repro with that anyway

borkdude15:09:37

figwheel main is really close to cljs.main anyway. this is the config I'm using for a big app I'm working on right now:

:cljs/dev {:extra-deps
                      {com.bhauman/figwheel-main {:mvn/version "0.2.11"}
                       devcards {:mvn/version "0.2.6"
                                 :exclusions [sablono cljs-react-reload]}
                       org.clojars.borkdude/cljs-react-reload {:mvn/version "0.1.2-SNAPSHOT"}
                       sablono {:mvn/version "0.8.6"}
                       re-frisk {:mvn/version "0.5.4.1"}}
                      :extra-paths ["src-cljs-dev" "frontend"]
                      :main-opts ["-m" "figwheel.main" "-co" "docsearch.cljs.edn"
                                  "-d" "frontend/public/js/app.out"
                                  "-o frontend/public/js/app.js"
                                  "-c" ""
                                  "-r"]}
           :cljs/prod {:extra-paths ["src-cljs-prod"]
                       :main-opts ["-m" "cljs.main" "-co" "docsearch.cljs.edn:docsearch-prod.cljs.edn"
                                   "-O" "advanced"
                                   "-o frontend/public/js/app.js"
                                   "-d" "frontend/public/js/app.out" "-c" ""]}

neilyio15:09:47

Thanks for the tip. Do you think what I'm looking for is possible? For example, Next.js requires a .js file (containing module.exports=my_render_func) in a specific pages folder for each html page that it generates. Think that's doable with boot/cljs.main?

neilyio15:09:51

Thanks for posting the config.

borkdude15:09:38

yeah, you'd have to use optimizations advanced (or simple) to get a single file and use ^:export on the function you'd like to expose

borkdude15:09:16

then that function will be in foo.bar.yourfunction in the JS if foo.bar is the surrounding namespace

neilyio15:09:48

Is that effectively a "default" export? I think that's what Next.js is looking for.

borkdude15:09:13

oh gosh, I don't know about that, you'd have to ask in #clojurescript

neilyio15:09:52

Will do. I'll read up on cljs.main now. Are you kicking it off with the clj tool?

neilyio15:09:03

Thanks so much for your help.

borkdude15:09:27

we are using cljs.main for the front-end now, it used to be all boot for front and back, our backend is still using boot, but probably we'll migrate everything over eventually to clj

borkdude15:09:21

not that we didn't like boot (it's amazing), but there were certain issues on Java 11 that we never got fixed with the current cljs tools

neilyio15:09:39

I've loved what I've seen of boot. It seems like clj is becoming standard, but it doesn't seem as intuitive.

👍 2