Bundling an application with OpenLayers 3
Now, as we know how to build custom libraries, let's take a step forward and learn how to compile our application with OpenLayers 3. This process has two steps. First, we have to edit our application as it has to be compatible with the Closure Compiler. Next, we have to create a custom configuration file, which can create a library with just the features that our application needs.
Editing the application
To make our application Closure-compatible, we have to make two modifications to it. You can either make these modifications in the JavaScript file of the previous example, called ch10_geocaching.js
, or open the provided modified file to check the result. The modified version is called ch10_geocaching_reworked.js
. First, we have to provide a namespace for our application. In this example, that namespace will be geocaching
. Next, we provide that namespace to the Closure Compiler using the Closure Library:
goog.provide('geocaching');
Next, we build...