Skip to content

Commit

Permalink
upgraded to mincer 5.x and fixed broken things
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdave committed Dec 17, 2013
1 parent d22defa commit 999a2a0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@import 'reset';
/*
*= require reset
*/

body {
font-family: helvetica, arial;
Expand Down
File renamed without changes.
34 changes: 12 additions & 22 deletions lib/connect-mincer.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,16 @@ var ConnectMincer = (function() {
;

if (!asset) return null;

// precompiling/compiling is no longer supported in Mincer 5.x which simplifies things for us - the
// asset itself will be compiled on the fly when a request for it comes in (except for in prod, but
// that's handled above and requires a manifest and compiled assets anyway)

if (this.production) {
// in production, return the asset with its digest path
paths.push(this._toAssetUrl(asset.digestPath));
} else if (asset.isCompiled) {
// in development, iterate this asset (there could be multiple if it's a bundle)
// and add each as a logical path (no digest), with ?body=1 as per sprockets
asset.toArray().forEach(function(a) {
paths.push(self._toAssetUrl(a.logicalPath) + '?body=1');
});
}
asset.toArray().forEach(function(a) {
// iterate this asset (there could be multiple if it's a bundle) and add
// each as a logical path (no digest), with ?body=1 as per sprockets
paths.push(self._toAssetUrl(a.logicalPath) + '?body=1');
});

return paths;
};
Expand Down Expand Up @@ -329,18 +328,9 @@ var ConnectMincer = (function() {
res.locals.asset_path = self.getHelper('asset_path');
}

if (!self.production && self.options.precompile) {
// if we're not in production, we should make sure all assets are precompiled
// on a request as they won't exist otherwise
self.environment.precompile(self.precompileList, function(err) {
if (err) {
return next(err);
}
next();
});
} else {
next();
}
// we have nothing else to do here, because precompiling has been removed in Mincer 5.x and asset
// paths are available immediately before being compiled (they get compiled properly when requested)
next();
};
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"main": "./lib/connect-mincer.js",
"dependencies": {
"mincer": "0.4.5",
"mincer": "0.5.12",
"underscore": "1.4.x"
},
"devDependencies": {
Expand Down

0 comments on commit 999a2a0

Please sign in to comment.