This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-19
Channels
- # adventofcode (82)
- # beginners (70)
- # boot (34)
- # boot-dev (13)
- # cider (45)
- # clara (4)
- # cljs-dev (3)
- # cljsrn (2)
- # clojure (91)
- # clojure-art (8)
- # clojure-czech (1)
- # clojure-dusseldorf (3)
- # clojure-france (11)
- # clojure-germany (1)
- # clojure-greece (39)
- # clojure-hamburg (1)
- # clojure-italy (24)
- # clojure-norway (2)
- # clojure-spec (7)
- # clojure-uk (31)
- # clojurescript (56)
- # core-async (7)
- # cursive (8)
- # data-science (10)
- # datomic (41)
- # duct (7)
- # emacs (1)
- # events (1)
- # fulcro (83)
- # graphql (6)
- # klipse (1)
- # leiningen (28)
- # lumo (67)
- # off-topic (14)
- # om (9)
- # onyx (3)
- # perun (4)
- # re-frame (22)
- # reagent (11)
- # ring-swagger (2)
- # rum (1)
- # specter (46)
- # sql (13)
- # uncomplicate (17)
- # unrepl (114)
How does boot choose the entry point to my code? (I’ve set up my project using tenzing
so I’m not sure how all of this works together.) I see that the reload
task has a :on-jsload
option that points to a function in my code, but if I wasn’t in development mode, what sets the top-level entry point?
@lee.justin.m top level forms in build.boot
are evaluated
if you want to make a script that has a definite entry point, with command line arguments and so on, you can define -main
as a top level var in your boot script
but this, for example, will be a working build.boot file:
(.println System/out "hello world")
if you're building a project the entry point is usually set via the command line, like boot dev
for example
yer bakin’ my noodle. so the entry point to a program is actually the toplevel of build.boot?
I had assumed that when I run boot build
, boot runs, reads some stuff, fires off some compilation, and then emits some javascript in an output directory.
What confuses me is that the template sets up an app.cljs
which has nothing except defn
s at the top level. I would have expected at least one function invocation at the toplevel so the program knows where to start.
the build.boot
file is evaluated, then if there is no -main
function defined in the build.boot
it tries to execute the build
task, because that's what was passed on the command line
inside the build.boot file are expressions that load dependencies, define tasks, require namespaces, etc
Yes. I think the answer is that this will not work in production. The only reason this is working now is because in the development run, the auto-reloader task has been informed as to where the entrypoint is. I’ll have to set up a webserver to test the theory though.
i think in most cases the build task can create the .cljs.edn file, or you might have one in the project
ah! yes that’s it. in the build output it creates an app.cljs.edn
that points to the init
function
oh yea tenzing
created one in the resources
directory. I’m not entirely sure why there is so much stuff in the target
directory after a production build