Created
February 17, 2012 01:33
The patch you didn't want to see
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/bin/browserid b/bin/browserid | |
index 5802ba3..482108e 100755 | |
--- a/bin/browserid | |
+++ b/bin/browserid | |
@@ -26,7 +26,8 @@ metrics = require('../lib/metrics.js'), | |
logger = require('../lib/logging.js').logger, | |
forward = require('../lib/http_forward'), | |
shutdown = require('../lib/shutdown'), | |
-views = require('../lib/browserid/views.js'); | |
+views = require('../lib/browserid/views.js'), | |
+postprocess = require('postprocess'); | |
var app = undefined; | |
@@ -180,6 +181,18 @@ app.use(function(req, res, next) { | |
next(); | |
}); | |
+// replace urls in CSS with perma urls with far future expiration for | |
+// optimal caching | |
+app.use(postprocess(function(req, content) { | |
+ if (req.res.getHeader('content-type').indexOf('text/css') === 0) { | |
+ content = content.toString().replace( | |
+ /url(\s*\'([^\']*)\'\s*)/, function(str, url) { | |
+ return "url('" + cachify.hashify(url) + "')"; | |
+ }); | |
+ } | |
+ return content; | |
+})); | |
+ | |
app.use(express.static(static_root)); | |
// open the databse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment