Fork me on GitHub
#figwheel-main
<
2020-05-18
>
dominicm13:05:48

@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.

dominicm13:05:02

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.

dominicm13:05:38

I have a workaround for now, so no rush

dominicm13:05:09

Hacky workaround is to use with-local-vars to bind it it into a clojure.lang.Var

πŸ‘ 4
Stuart22:05:23

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 
[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 
Then it just sits there, no repl...

bhauman22:05:17

@qmstuart does a browser pop open?

Stuart22:05:27

it does, and it disp;lays my Hello, World! with red text from my css

bhauman22:05:13

and if you reload the browser no change?

Stuart22:05:58

I think I'm obviously misunderstanding how the .edn files are used

bhauman22:05:11

I think you are doing ok actually

bhauman22:05:24

look in the web inspector console of the browsers devtools

Stuart22:05:32

Loading failed for the <script> with source "".
Why it would be looking for a file from the tutorial I went through?

Stuart22:05:48

ah, i bet i've copied the index.htnml

Stuart22:05:50

and not chnaged it

bhauman22:05:35

yeah if you get rid of the index.html entirely it should work

Stuart22:05:36

how should i be naming things? I've noticed I put _ and - in my folder names, which is confusing me.

Stuart22:05:46

should i avoid - and _ ?

bhauman22:05:08

that’s a clojure thing

Stuart22:05:11

or just treat it how I do in Clojure when using dashes and underscores with namespaces

Stuart22:05:15

oh, so its just the same?

bhauman22:05:10

did you see what I said about getting rid of the index.html entirely?

bhauman22:05:20

figwheel will make one for you

bhauman22:05:53

and it provides a div on the page with an β€œapp” id that you can write to

bhauman22:05:11

thats to help you bootstrap

bhauman22:05:38

once things get rolling you can create your own html page with a reference to your main.js

bhauman22:05:02

but if you use the figwheel index page first its easy to copy it and modify it

Stuart22:05:11

great, thanks!

Stuart22:05:24

i'm pretty new to front end stuff