Skip to content
This repository has been archived by the owner on Dec 20, 2017. It is now read-only.

Commit

Permalink
allow ?cache=busters on middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallen23 committed Apr 11, 2012
1 parent 7a62d8a commit f62842e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/middleware.js
Expand Up @@ -8,14 +8,15 @@ Masher.prototype.middleware = function(options) {
console.warn('Masher middleware should not be used in production');
}
return function(req, res, next) {
if (/\.(styl|js|less|css)$/.test(req.url)) {
var filename = path.join(self.config.assetPath, req.url);
fs.stat(filename, function(err, stats) {
if (/\.(styl|js|less|css)($|\?)/.test(req.url)) {
var file = req.url.split('?')[0];
var fullpath = path.join(self.config.assetPath, file);
fs.stat(fullpath, function(err, stats) {

fs.readFile(filename, 'utf8', function(err, source) {
fs.readFile(fullpath, 'utf8', function(err, source) {
if (err) throw err;
var asset = {
filename: filename,
filename: fullpath,
source: source
};
self.processPlugins(asset, self.config.plugins.pre, function() {
Expand Down

0 comments on commit f62842e

Please sign in to comment.