Skip to content

lambdaisland/thirdpartyjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

thirdpartyjs

A demonstration of the various ways to consume a third party library from ClojureScript.

For the full background on these approaches, watch out for the upcoming Lambda Island episode, "Using JavaScript libraries from ClojureScript".

Usage

Check out the relevant branch, then build the project

lein cljsbuild once dev

and open 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

Branches

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.

Liks script-d3, but add externs for the features we're using. Advanced compilation works again.

Like 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 :foreign-libs and :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?

License

Copyright © 2016 Arne Brasseur

Distributed under the Mozilla Public License 2.0

About

Demonstration of how to use third party JS in ClojureScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published