On Jan 14, 2014, at 9:26 AM, Ivan L wrote:
> This is excellent work! I played around with cljs-start tonight, thanks so
> much for your work.
I'm glad you find it useful.
>
> One hopefully quick question. Assuming the CCW lein headless start and then
> (run) and (browser-repl), how can the cljs namespace being edited be updated?
I have to admit that I touched CCW for the very first time last weekend,
because Laurent Petit needed an example of austin configuration and usage for
improving CCW interoperability with complex project/templates.
So, I really don't how to keep the CLJS repl updated in CCW.
>
> My first thought was to simply use ccw to reload or evaluate selection to
> repl, but it seems to fail randomly (or maybe its missing dependences?
Pay attention at the namespaces in the cljs repl and in the editor window.
Again I don't know about CCW, but is the same thing I do in emacs.
> Another thought would be to run another repl external to eclipse and have
> that be cljsbuild auto and keep on reloading the page (localhost:3000)
> manually.
Depends on the workflow that works better for you.
Recently I found my self in the following situation:
- no matter how better is becoming the CLJS REPL experience, I still prefer the
CLJ REPL. To me, JS in an accident. Is here to stay, like the R&R, but less
JS/HTML/CSS code I read, the better for my eyes and my brain too
Because of this bad attitude towards JS, I'm starting experimenting the
following workflow:
Principles and guide lines
- keep the CLJS code which implements logics separated from the CLJS code which
implements rendering (which I'm very bad for).
- write the CLJS code which implements the logic in pure CLJ code (i.e. cljx
lein plugin);
- write the CLJS code which implements the unit tests of the above code in pure
CLJ code (.cljx extensions);
- use a testing lib with the same API on both sides (i.e. java and JS). The
only one I'm aware of is clojurescript.test/clojure.test (in the near future
I'd like to introduce double-check too in my workflow).
Now the corresponding workflow:
- open your project in the editor/ide you prefer (last week for the very first
time I did not use emacs)
- from a terminal launch the `lein cljx auto` task.
- from an other terminal, launch the `lein cljsbuild once` task
- launch the `lein test-refresh` task (test-refresh is a lein plugin)
Now in one terminal you can see the clix running when you save your code. It
generates both clj and cljs code, but at the beginning I take care of CLJ only.
In the other terminal you see the unit testing being re-executed because in the
mean time the newly generated clj code/unit tests code have been recompiled.
The test-refresh does this work for you.
I always like to have a CLJ REPL around me to test something small that allows
me to isolate what I need at the moment. I don't know how to do it with CCW,
but I do it both in emacs and in Light Table, so there should be a way to
reload the clj/cljs code from CCW into the REPL.
When the code works for CLJ:
- I launch the `lein cljsbuild auto` task from a third terminal. Hopefully
everything get compiled. If not, fix the bug. In is not you bug, it could be a
subtle difference between CLJ and CLJS, or, better, a bug in CLJS that you
search/submit in JIRA
- If everything gets compiled, I launch the `lein cljsbuild test` command from
a fourth terminal.
- If all tests passed, then you have to repeat them with more aggressive
compilation options.
Do the following:
- lein clean
- lein with-profiles simple do clix once, cljsbuild once, cljsbuild test
You can eventually add a lein :alias for the above chain.
If everything is still working with the simple compilation, you can now go on
with the :advanced compiler option.
- lein with-profiles simple clean
- lein with-profiles advanced clix once, cljsbuild once, cljsbuild test
At the moment this is the shortest path I found to have something to work with.
I think I should add hardness to cljs-start, the sort of thing Stuart Sierra
did.
There are two things that really annoy me at the moment:
- the fact that I can't use the :none compilation option in the :dev profile,
because clojurescript.test does not support it. This is a pity, because the
compilation time with the :none compilation its really unbelievable fast after
the very first time, while the :whitespace compilation time gets you irritable
- the fact that that I did not find a test-plugin correspondent for
cljurescript.test. Probably with some efforts someone could make test-refresh a
two sides guy.
HIH
Mimmo
>
> What do you suggest?
>
> Thanks again, thanks for such great work.
>
> --
> Note that posts from new members are moderated - please be patient with your
> first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, sen