mozilla/tabzilla — pull request #25 by peterbe (2012-05-24 18:03:49+00:00)
Title: basic working version of build script (ROUGH DRAFT)

This is a rough draft to solve the problem with hosting tabzilla for optimal speed. Here's the bug for it: https://bugzilla.mozilla.org/show_bug.cgi?id=757559

* The build script takes a copy of the css, img and js directories and puts them in a directory called `build/latest/`. Inside you'll find `tabzilla.min.css` and `tabzilla.min.js`.

* It also copies the "latest/" directory and calls it by the latest git hash ID. e.g. `build/versions/eab1444/`
I really wish tabzilla had a versioning scheme since that would be much more informative than a git hash. I.e. `1.2 > 1.1`

* You run it with `make compile` or just `make` which defaults to running verbose and with Google Closure compiler. You can alternatively just run `python bin/build.py --uglifyjs` yourself if you like.

* You can also run `make test` which will serve up and open a test page referencing the minified versions.

* `uglifyjs` is much faster than `compiler.jar` but produces a bigger output because it keeps the huge copyright comment.

* The idea is that you set up a CDN or something with `Cache-Control: max-age=3600` for the `latest/` version and one with `Cache-Control: max-age=315360000` for the versioned one.

* MORE work is needed in tidying up the referencing of relative images. When minifying the `tabzilla.css` file we should re-write every local URI (e.g. `/media/img/foo.png`) to a relative one with and without a versioned filename (for the aggressive caching) (e.g. `../img/foo.eab1444.png`). I wouldn't start using this build script and hosting it till this feature is cracked. However, it would for now just mean sub-optimal hosting of the images.