Siteglass
Siteglass is a tool for bundling and compressing your Javascript, CSS and images for the web. It aims to provide advanced features like AMD support and cache-busting in a simple, standalone package that works with any framework.
Installation
Siteglass is written in python with one little C extension so you'll need a C compiler and the Python headers installed. Then it's a snap:
$ git clone git@github.com:cooper-software/siteglass.git
$ cd siteglass
$ python setup.py install
This will install the siteglass python module as well as an executable siteglass script that's used to invoke siteglass.
Example
The source distribution contains a simple example that shows off CSS, Javascript and image compression within a project using require.js. To run the example…
$ cd /path/to/siteglass/example
$ siteglass
This will read the configuration file siteglass.json, create a new dist directory, copy all the source files, merge and minify the Javascript and CSS, optimize the images and rewrite the paths inside index.html to their cache-busting counterparts.
Have a look at the configuration file.
Command line usage
The siteglass command is very simple. Most of the control over how siteglass runs is defined in the configuration file. By default, all the build phases that are configured will run. However, the script options allow you to run only specific build phases, if that's what you need. Run siteglass -h for this:
usage: siteglass [-h] [--copy] [--js] [--amd] [--css] [--images] [--config CONFIG]
Merge & compress javascript, css and images.
optional arguments:
-h, --help show this help message and exit
--copy Run copy rules
--js Run javascript rules
--amd Run AMD rules
--css Run CSS rules
--images Run rules for images
--config CONFIG Location of the config file
Configuration file
The configuration file is a JSON formatted file that sets global options for siteglass and defines various build phases. By default, when is run it will look for a file in the current director. You can name your config file something else and put it anywhere you like by calling with the option.