Go back to caching static assets.

Reverts change released in 0.5.5.
This commit is contained in:
Nick Martin
2013-03-01 18:43:20 -08:00
parent e5a0734fa4
commit 105cb9e67f

View File

@@ -180,8 +180,21 @@ var run = function () {
var app = connect.createServer();
var static_cacheable_path = path.join(bundle_dir, 'static_cacheable');
if (fs.existsSync(static_cacheable_path))
app.use(gzippo.staticGzip(static_cacheable_path, {clientMaxAge: 1000 * 60 * 60 * 24 * 365}));
app.use(gzippo.staticGzip(path.join(bundle_dir, 'static'), {clientMaxAge: 0}));
// cacheable files are files that should never change. Typically
// named by their hash (eg meteor bundled js and css files).
// cache them ~forever (1yr)
app.use(gzippo.staticGzip(static_cacheable_path,
{clientMaxAge: 1000 * 60 * 60 * 24 * 365}));
// cache non-cacheable file anyway. This isn't really correct, as
// users can change the files and changes won't propogate
// immediately. However, if we don't cache them, browsers will
// 'flicker' when rerendering images. Eventually we will probably want
// to rewrite URLs of static assets to include a query parameter to
// bust caches. That way we can both get good caching behavior and
// allow users to change assets without delay.
// https://app.asana.com/0/2604819267102/4310170949669
app.use(gzippo.staticGzip(path.join(bundle_dir, 'static'),
{clientMaxAge: 1000 * 60 * 60 * 24 * 7}));
// read bundle config file
var info_raw =