From 98f56b53b4f788e00daabf7b22d166cb48c2648e Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 19 Feb 2012 18:37:31 -0800 Subject: [PATCH] Use cache for minified assets. --- node/server.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/node/server.js b/node/server.js index 2110a301..d324736b 100644 --- a/node/server.js +++ b/node/server.js @@ -142,10 +142,13 @@ async.waterfall([ gracefulShutdown(); }); - //serve static files + // Cache both minified and static. var assetCache = new CachingMiddleware; - app.all('/static/:filename(*)', assetCache.handle, minify.minify); - + app.all('/(minified|static)/*', assetCache.handle); + + //serve static files + app.all('/static/:filename(*)', minify.minify); + //serve minified files var jsServer = new (Yajsml.Server)({ rootPath: 'minified/' @@ -156,8 +159,6 @@ async.waterfall([ Yajsml.associators.associationsForSimpleMapping(minify.tar); var associator = new StaticAssociator(associations); jsServer.setAssociator(associator); - var assetCache_other = new CachingMiddleware; - app.all('/minified/:filename', assetCache_other.handle); app.use(jsServer); //checks for padAccess