Skip to content

Instantly share code, notes, and snippets.

@martinklepsch
Last active August 29, 2015 14:08
Show Gist options
  • Save martinklepsch/1836dd80be7b585c73e3 to your computer and use it in GitHub Desktop.
Save martinklepsch/1836dd80be7b585c73e3 to your computer and use it in GitHub Desktop.

Problem

JS-Interop is a significant feature of Clojurescript but as soon as you want to deploy your app you'll need extern files that enable advanced compilation features.

This is a blocker for people unfamiliar with the Closure compiler and for the Clojurescript community in general. Lots of time is wasted if everyone figures this out on his own.

Idea For A Solution

Build up a repository on github that contains a selection of Javascript libraries including working extern files. As these files end up on the classpath when specified as dependency, they can easily be used from anywhere in the project.

Each directory in the project corresponds to one JS library and can be deployed to Clojars under a specific group-id.

To help people with creating a directory that is consistent with the existing ones and can be deployed to clojars there should be a Leiningen template that gives the skeleton.

Alternatives

Obviously the best solution would be to somehow integrate this into the Clojurescript compilation process but externs generation is not automatable for every JS library, some need special treatment.

Then there is lein-cljs-externs which allows you to define externs in your source files. This involves an additional build and does not provide any performance benefits over supplying complete externs files. (see this discussion on the Closure ML).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment