Bruce Hauman writes about ClojureScript, covering Figwheel live coding, Devcards, core.async and interactive development.
HN commenters point to it for interactive ClojureScript development, citing the Figwheel Flappy Bird demo, Devcards, core.async tutorials and some Emacs tips.
Does anyone know how to get ClojureScript working with VueJS? Specifically with .vue files?
I want to be able to write:
<template>
... some HTML ...
</template>
<script lang="cls">
(def app (js/Vue. (js-obj "el" "#app"
"data" (js-obj "message" "Hello Vue!"
"articles" articles
))))
</script>
<style lang="stylus">
... some scoped CSS ...
</style>
Turns out, this is really hard! What's the proper way to set this up?
I'm surprised ClojureScript doesn't have a Webpack loader. People have been asking about it: https://groups.google.com/forum/#!topic/clojurescript/HNuYCfPRtQw (May 2017)
Is this fundamentally a bad idea for some reason?
ClojureScript devcards are awesome: https://github.com/bhauman/devcards
http://rigsomelight.com/devcards/#!/devdemos.core
But if ClojureScript can't integrate with Webpack, it seems like a no-go. Is it possible?
(The `(js/Vue. (js-obj ...` is annoying, but macros can easily fix that.)
I've come to appreciate some of the new ES6 features (anonymous functions, lets) much more after using their equivalents in ClojureScript.
Also, The interactive REPL based workflow that a lot of the LISP languages utilize is extremely appealing. I've been thinking a lot about how to bring this back into the JS world. I have yet to find any good literature on it, but I will be exploring this area more.
For those curious, here are some blogs that convinced me to finally give Clojure a spin:
- http://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html (seems like this is the stereotypical "you should try ClojureScript because... " post)
- http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded (a bit code-heavy, but an admirable workflow)
- http://swannodette.github.io/2013/11/07/clojurescript-101/ (dealing with asynchronous code)
I'm curious HN, anyone out there making strides in interactive JS development, akin to the 2nd blog post I referenced above?
I'm real curious about the potential interplay between core.async and om/react. Bruce Hauman has a great tutorial on using core.async channels (as opposed to event callbacks) to process user input and gestures.[1] David Nolen (creator of Om) also covered core.async.[2] But these tutorials pre-date Om; core.async came to clojurescript in summer 2013, Om wasn't released until 2014.
I guess the way React handles input is by attaching event handlers to child components, so that changes to the child properties bubble up to the root component state. Is this the optimal pattern for handling events in a React app? Or is there an advantage to be gained by using core.async channels to process event input for Om/react?
I haven't seen any examples which use both core.async and Om/react, but I'm very curious about the possibility.
1. http://rigsomelight.com/2013/07/18/clojurescript-core-async-todos.html
2. http://swannodette.github.io/2013/07/12/communicating-sequential-processes/
Clojure(script) has a pretty good story around this. But I hear tell that common lisp has even more powerful hot reloading magic.
But, in clojure if you idiomatically model your app state as plain-ol-data, and naked functions that modify it, then you are in dynamic editing heaven. You can make any change at runtime as long as your live data is still compatible with the functions that use it.. which ends up being most of the time unless you change the semantics of an attribute.
Might not be the best example, but this article goes over live-coding a flappy bird clone
https://rigsomelight.com/2014/05/01/interactive-programming-flappy-bird-clojurescript.html
I'm not a core.async/UI wizard but have a look at this [0].
It's a tutorial for building a reactive ToDo List application using core.async for event processing, crate [1] for rendering and jayq [2] for DOM manipulation and ajax calls.
Interesting, though I use re-frame [3].
[0] http://rigsomelight.com/2013/07/18/clojurescript-core-async-todos.html
[1] https://github.com/ibdknox/crate
[2] https://github.com/ibdknox/jayq
[3] https://github.com/Day8/re-frame
Om hot reload doesn't require Light Table or browser plugins, just eval support from your editor setup. There's no way to see this easily beyond going through the Om tutorial. But as you say this is just a benefit that more or less falls out of React if you're careful w/ state - Devcards is another ClojureScript example of the possibilities - http://rigsomelight.com/2014/06/03/devcards-taking-interactivity-to-the-next-level.html