I’ve been having a reasonably productive time getting up to speed with ClojureScript for my Harrisburg city crime tracker. One difficult bit of trial-and-error I came across is successfully compiling the Google Maps API into my app with advanced optimizations set. The Google Closure compiler munges identifiers so you need an “externs” file so it knows which names correlate to what from your CLJS code.
Here’s what I have in my
:externs vector is a list of all the externs JS files (which are
then placed in the
src/cljs directory — actually I should put them
src/cljs/externs directory for organization’s sake).
The contents of
google_maps_api_v3.js come from
Then, you can use the Maps API from inside your CLJS via the normal JS interop methods:
For further examples, you can refer to the hbg-crime.org source.