A demonstration of the various ways to consume a third party library from ClojureScript.
Check out the relevant branch, then build the project
lein cljsbuild once dev
resources/public/index.html in your browser.
You can also try advanced compilation, which works for some setups, but not for others.
lein clean lein cljsbuild once prod
Use D3 from http://cljsjs.github.io . Works for both dev and prod builds
Use D3 from by loading it from a CDN. Works only for the dev build.
script-d3, but add externs for the features we're using. Advanced compilation works again.
script-d3-externs, but with auto-generated externs.
Implements leftPad as a Google Closure module, loads it by putting it on the classpath.
Compile D3 to a single ES6 file with Rollup, then use that directly with
:module-type :es6. Broken for advanced compilation, probably because D3 violates some of the Closure assumptions. (Lots of warnings on advanced compilation).
Include D3 with
:externs. This is what CLJSJS currently does. Works for advanced compilation.
Another example of using the ES6 module support, but with a twist: the ES6 module in turns depends on a CLJS namespace. Full ES6/ClojureScript interop, how cool is that?
Copyright © 2016 Arne Brasseur
Distributed under the Mozilla Public License 2.0