Skip to content
candera edited this page Jan 4, 2012 · 3 revisions

Production

The ultimate goal of this project is to help you get an application into production.

ClojureScript utilizes Google Closure's compiler to compile all of the JavaScript code in your project into a single file. When you visit the development view of the application, each JavaScript file that is required as well as all of the compiled JavaScript for your application will be loaded as individual JavaScript files. For the sample application, at the time of this writing, this adds up to 114 JavaScript files and a total size of 1612K.

YSlow generates the following report:

dev weight

When viewing the application in the production view, all JavaScript will exist in a single file. For the sample application, at the time of this writing, the file is 167.5K.

prod weight

Apart from admiring how small the production version of the application is, the production view allows you to confirm that this version of the application works. It is possible to do things that are not compatible with advanced compilation.

One example of something that can break advanced compilation is evaluating a JavaScript string. This string may contain code which attempts to call a function using a name which will not exist after minification. The Google Closure compiler is not smart enough to know that the string contains code which must also be minified.

After making changes to the application, the production view may take a long time to load. This time is due to the time it takes to advanced compile the application.