Closed alexandergunnarson closed 6 years ago
Don't want to derail the conversation too much but if you don't require the UI side of lein-figwheel
and you only care about the engine, you should really at https://github.com/anmonteiro/lumo.
It is a fully fledged REPL/compiler.
Thanks for the suggestion @arichiardi! I do like that Lumo does CLJS-in-CLJS compilation specifically for V8 (which is what e.g. Chrome runs), but I have two questions:
1) Does it auto-recompile code you change à la Figwheel or tools.namespace? 2) Does it auto-refresh the page when it detects a change?
I suppose I could implement 2) provided I hook into the system doing 1). 1) is the biggest deal to me, and I could see myself adding on various nice-to-have functionality on top of it. But then again I don't want to have to reimplement Figwheel myself. It would be nice if Figwheel had compiler support for more than just cljsbuild, or even better, if cljsbuild had support for more than just the standard CLJS-via-CLJ compiler. There's a lot of ways to go about this and I'm not sure yet what the best one is. Optimally I'd like to always have my object language and metalanguage be the same (as in Clojure), but this is a lofty goal.
No well I wanted to say that
if you don't require the UI side
Then you could use lumo
. I would develop the engine with it as a library anyways :smile:
You can compile and watch-compile your code of course.
The moment you need to show things in a browser then lein-figwheel
becomes necessary because lumo
does not communicate with a browser...it is just a REPL and a compiler.
Right, I saw your if you don't require the UI side
bit — I had just been wondering what that encompassed :) Well, maybe I can hook up something with Lumo and Figwheel then — perhaps it wouldn't be too painful haha. I've played around with Figwheel internals enough to get a feel for them.
That said, maybe @bhauman already has the CLJS-in-CLJS direction in mind and has something to say as well!
@alexandergunnarson I had dig in there as well for boot-figreload
, if you really do that feel free to ping me for anything that comes to mind.
So if you need cljs-eval capability you need to embed the compiler in the runtime of your project.
So basically you need to require the js.cljs
namespace and call eval https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/js.cljs#L827
Bootstrapped cljs doesn't bundle the compiler into the compiled results. The product of bootstrapped cljs compile doesn't allow you to call eval by default.
So, you can call "eval" in a figwheel compiled project just fine as long as
you include the js.cljs
namespace
An example of how to do this is here: https://github.com/ctford/klangmeister/blob/master/src/klangmeister/compile/eval.cljs#L53
Sounds good @arichiardi — I might explore doing that in the coming week or two. I'll let you know!
Oh awesome @bhauman! I will take a look and get back to you if I have any questions. Thanks for your response!
I was wondering whether it's possible to use https://github.com/swannodette/cljs-bootstrap as the compiler for Figwheel and if you've ever tried it. Normally I've just stuck with a lot of
:clj
/:cljs
conditionalization, especially for macros, but for the particular project I'm working on to be effective, I need the source language to be the same as the compilation language. This is because I'm trying to create a type system that is able to leverage arbitraryclojure.core.spec
definitions by evaluating them at compile time to elide as many runtime checks as possible.Any insights you could offer on this would be greatly appreciated!