@bhauman it would be handy if a post build hook could be a fn. Just about to read the source to figure out if that's basically already valid and I need to turn off config validation.
https://github.com/bhauman/figwheel-main/blob/640ece287aa05b7d08eab083b261f1ae866f7293/src/figwheel/main.cljc#L774 I suppose if this had a fn?
check too?
My use-case is that I'm using a locally scoped fn inside of an integrant component so I have access to a promise I created, which I use to make sure I only start one webpack watcher.
I have a workaround for now, so no rush
Hacky workaround is to use with-local-vars
to bind it it into a clojure.lang.Var
I'm trying to understand figwheel-main. I've got to a stage where I have a simple layout
.
βββ deps.edn
βββ deps.edn~
βββ foo-dash.cljs.edn
βββ resources
βΒ Β βββ public
βΒ Β βββ css
βΒ Β βΒ Β βββ style.css
βΒ Β βββ index.html
βββ src
βΒ Β βββ foo_dash
βΒ Β βββ core.cljs
my foo-dash.cljs.edn looks like this:
^{:css-dirs ["resources/public/css"]}
{:main foo_dash.core}
My deps.edn
{:deps {com.bhauman/figwheel-main {:mvn/version "0.2.5"}
com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
reagent {:mvn/version "1.0.0-alpha2"}}
:paths ["src" "target" "resources"]}
I run:
$ clojure -m figwheel.main
I get the main figwheel webpage and a repl. Nice, that works.
But when I do:
$ clojure -m figwheel.main --build foo-dash --repl
I see my index.html, but no repl...
What am I doing wrong here that I never get a REPL?
2020-05-18 23:13:37.941:INFO::main: Logging initialized @3499ms to org.eclipse.jetty.util.log.StdErrLog
[Figwheel] Compiling build foo-dash to "target/public/cljs-out/foo-dash-main.js"
[Figwheel] Successfully compiled build foo-dash to "target/public/cljs-out/foo-dash-main.js" in 0.537 seconds.
[Figwheel] Watching paths: ("src") to compile build - foo-dash
[Figwheel] Starting Server at <http://localhost:9500>
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
[Rebel readline] Type :repl/help for online help info
Opening URL <http://localhost:9500>
Then it just sits there, no repl...@qmstuart does a browser pop open?
it does, and it disp;lays my Hello, World! with red text from my css
and if you reload the browser no change?
nope
I think I'm obviously misunderstanding how the .edn files are used
I think you are doing ok actually
look in the web inspector console of the browsers devtools
Loading failed for the <script> with source "<http://localhost:9500/cljs-out/cruel-main.js>".
Why it would be looking for a file from the tutorial I went through?ah, i bet i've copied the index.htnml
and not chnaged it
yep
yeah if you get rid of the index.html entirely it should work
how should i be naming things? I've noticed I put _ and - in my folder names, which is confusing me.
should i avoid - and _ ?
thatβs a clojure thing
or just treat it how I do in Clojure when using dashes and underscores with namespaces
oh, so its just the same?
yep
cool
did you see what I said about getting rid of the index.html entirely?
figwheel will make one for you
and it provides a div on the page with an βappβ id that you can write to
thats to help you bootstrap
once things get rolling you can create your own html page with a reference to your main.js
but if you use the figwheel index page first its easy to copy it and modify it
great, thanks!
i'm pretty new to front end stuff
π