Skip to content

Files

Latest commit

f2b45b8 · Aug 2, 2012

History

History
102 lines (78 loc) · 4.06 KB

closure_install_instructions.md

File metadata and controls

102 lines (78 loc) · 4.06 KB

Closure tools setup

Closure is a web development tool that was open sourced by Google in 2010.
https://developers.google.com/closure/

The Closure suite of tools consist of 5 useful tools

  • Compiler
  • Library
  • Templating system (Soy)
  • Linter
  • Stylesheets system

Create a folder called 'closure' to hold the tools in the Closure suite. Once setup is complete you will have 5 folders within this closure folder:

To setup the Closure tools you will need to checkout all 5 repos. Additionally you will need to build from source a .jar file for three of the projects (the compiler, templating system, and stylesheet system).

Ant

Before you can build any of the sources, you'll first need to install Ant if you don't have it already.

If you are using Windows, try http://code.google.com/p/winant/.

When installing Ant, be sure to use a Java 1.6 SDK or some later steps may fail.

Compiler

Docs about Closure's JavaScript compiler: https://developers.google.com/closure/compiler/
Project home: https://code.google.com/p/closure-compiler/
Here are the specific checkout and build commands I'm using on my Mac.
svn checkout http://closure-compiler.googlecode.com/svn/trunk/ closure-compiler
cd closure-compiler
ant jar
cd ..

Make sure it ends with a line stating:
Building jar: /closure/closure-compiler/build/compiler.jar
BUILD SUCCESSFUL

Library

Docs about Closure library: https://developers.google.com/closure/library/
Project home: http://code.google.com/p/closure-library/
My checkout command:
svn checkout http://closure-library.googlecode.com/svn/trunk/ closure-library

No building step necessary, just a checkout.

Templating system (Soy)

Docs about Closure's templating system: https://developers.google.com/closure/templates/
Project home: http://code.google.com/p/closure-templates/
My checkout and build commands:
svn checkout http://closure-templates.googlecode.com/svn/trunk/ closure-templates
cd closure-templates
ant SoyToJsSrcCompiler
cd ..

Make sure it ends with a line stating:
Building jar: /closure/closure-templates/build/SoyToJsSrcCompiler.jar
BUILD SUCCESSFUL

Linter

Docs about Closure's Linter: https://developers.google.com/closure/utilities/
JavaScript Guidelines checked: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml
Project home: http://code.google.com/p/closure-linter/
Checkout command (setup step is optional. Adds to modify the /usr/local/bin):
svn checkout http://closure-linter.googlecode.com/svn/trunk/ closure-linter
cd closure-linter
cat README
python ./setup.py install
cd ..

After installing, you get two helper applications installed into /usr/local/bin:
gjslint.py - runs the linter and checks for errors.
fixjsstyle.py - tries to fix errors automatically.

Stylesheets

Docs about Closure's Stylesheet minification: http://code.google.com/p/closure-stylesheets/
Project home: http://code.google.com/p/closure-stylesheets/
Checkout and build commands:
git clone https://code.google.com/p/closure-stylesheets/
cd closure-stylesheets
ant

Make sure it ends with a line stating:
Building jar: /closure/closure-stylesheets/build/closure-stylesheets.jar
BUILD SUCCESSFUL


So now you've got all the Closure tools installed and ready to go! Now how do you use them?