closure-boilerplate
closure-boilerplate copied to clipboard
Google Closure-based project boilerplate
Google Closure Boilerplate
This boilerplate should be able to work as the base of any Google Closure-based application.
The idea is that you clone this repository, modify the build settings and start working on your app.
Read this blog post to learn more about the resulting environment. The current stack is a bit different.
What's included
- a basic directory structure
- package manager support: npm, Twitter Bower
- JavaScript compiler support: Google Closure Compiler
- Templating support: Google Closure Templates
- JavaScript linter support: Google Closure Linter
- CSS compiler support: rework
- automation task support: grunt.js
- a source map fixing script that fixes wrong file paths
- an HTML file compiler script that extracts JavaScript references (awesome for AngularJS) for instance)
- a Sublime Text project file
Dependencies
- unix-based OS (Mac OS X, linux) or unix-like environment (cygwin)
- node.js
- Twitter Bower: Install as
npm install -g bower - Google Closure Linter – optional, used only by the
lint.shscript to check syntax
Installation
Do not fork this repository to use it. Fork only if you want to contribute. Thanks.
git clone -o boilerplate git://github.com/jankuca/closure-boilerplate.git project-name
cd project-name
./build/install.sh
Then, you have two options:
- You can reset the repository by running
rm -rf .git && git init. - You can keep the history and the remote to be able to merge future boilerplate commits to your application. The
make.shscript makes sure theboilerplateremote points to this repository. When there are new commits to the boilerplate, you can merge them to your app by running
git fetch boilerplate
git merge boilerplate/master --no-ff -m 'update closure-boilerplate'
Usage
You will probably need to have a Terminal window open at all times (which is the way you should work anyway).
You can either take advantage of the prepared grunt.js tasks or run the scripts manually:
# Run these commands in the project root directory
# == Build the whole app ==
grunt
# == Compile CSS ==
grunt css
# (or)
./build/rework.js
# == Generate a deps file + compile JavaScript ==
grunt js
# (or)
./build/deps.sh
./build/compile.sh
# == Lint JavaScript ==
grunt lint
# (or)
./build/lint.sh
# == Compile templates ==
grunt soy
# (or)
./build/soy.sh