Open raxod502 opened 7 years ago
In particular, the examples/separate-server
project exhibits the same behavior. If you launch Figwheel from figwheel-sidecar.repl-api
, then a page is opened pointing at localhost:3000
which of course doesn't work since the server hasn't been started.
The :init
and :destroy
features are only available from Leinigen.
The reason for this is that it is trivial to call your own start and stop f unctions directly from your own script. This feature is intended for the Leinigen environment where it is very difficult to compose functionality.
On Sat, Jul 22, 2017 at 1:26 PM, Radon Rosborough notifications@github.com wrote:
In particular, the examples/separate-server project exhibits the same behavior. If you launch Figwheel from figwheel-sidecar.repl-api, then a page is opened pointing at localhost:3000 which of course doesn't work since the server hasn't been started.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bhauman/lein-figwheel/issues/583#issuecomment-317198162, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAKQPBrLbKeWlyw5f7ymAUx61GqPg0dks5sQjDKgaJpZM4OgEag .
That makes sense. Perhaps I should elaborate on my use case. In CIDER, you can launch a fully integrated ClojureScript REPL by specifying a form to be evaluated to turn a Clojure REPL into a ClojureScript REPL. For example, these are the built-in forms. I'm using the Figwheel-sidecar
one.
So this means that I can launch a ClojureScript REPL for any project simply by pressing C-c M-J
. But it doesn't work if I rely on :init
and :destroy
, since those hooks aren't run by figwheel-sidecar.repl-api
!
I understand for most use cases (scripting…), it's trivial to call my hook functions manually. But unfortunately it's not as straightforward to do this from Emacs—I don't want to hardcode my hook functions for every project.
I could implement reading the project.clj
and extracting the hook functions, but figwheel-sidecar
already implements this logic. Is there a straightforward way that I can invoke the hook functions defined in the project.clj
manually? (I totally understand that you wouldn't want to change the default behavior though.)
I have my Figwheel configured as follows:
This means that when I start
lein figwheel
, it starts my Ring server instead of its own server:Note especially the line
which is printed by my
:init
function.Now on the other hand, when I use
figwheel-sidecar.repl-api
to start my CLJS REPL, as advised on the wiki, I get this:Notice the conspicuous failure to run my
:init
function. Instead, Figwheel has started its own server.You can see the full project here.