The source for Coherent recently moved over to GitHub. You can pull down a clone of the source repository either using git or subversion:
git clone git://github.com/jeffwatkins/coherent.git
or
svn checkout http://svn.github.com/jeffwatkins/coherent.git
You’ll need to install Coherent’s code generation tools to build the project. These are distributed as Ruby gems, so you install them in the usual way:
sudo gem install coherent
Then, you can build everything:
cd coherent
distil
And you’re done. In the build folder are four versions of the coherent library:
coherent-debug.js- This is the debugging and development version of the library. Using this version makes it easier to track down errors, especially if you’re hacking on the Coherent source itself.
coherent-uncompressed.js- This is a single file that contains all the source files from the Coherent library concatenated in the correct order.
coherent.js- This is the concatenated and minimised version of the library. This is ideal for deploying into production, because it’s small and will download quickly.
coherent.js.gz- This is the same file as
coherent.jsexcept it’s already gzip encoded to reduce the load on your server.
Including Coherent
If you’re using Distil to build your project, including coherent is easy. Just add a reference to coherent-uncompressed.js to your Javascript sources and your output files will include all of coherent.
For example, the distil.yml file from the sample application looks like this:
yourproject.js:
# Your main Javascript assets, specified in order they should be loaded.
# The final entry loads all Javascript assets in the src/js folder and
# uses the import statements to compute the dependency order.
- coherent-uncompressed.js
- src/js/sample.js
- src/js
Distil will first include the uncompressed version of the coherent library, then the file sample.js, then any other Javascript files in the src/js tree. Because everything is packaged up in one file, your page will load faster.