Permalink
Browse files

Pushing hotfix 0.1.2-2

  • Loading branch information...
1 parent d6e70d2 commit 218f0f2acd1d81ed76e618ff0f12fc6c3a781fef @mekwall committed Feb 8, 2012
Showing with 29 additions and 16 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 .npmignore
  3. +4 −0 HISTORY.md
  4. +22 −15 lib/resmin.js
  5. +1 −1 package.json
View
@@ -1,2 +1,3 @@
node_modules
*.min.*
+*.log
View
@@ -3,4 +3,5 @@ test
testing
examples
*.log
+*.tmp
node_modules
View
@@ -1,3 +1,7 @@
+0.1.2-2 / 2012-02-08
+
+ * Hotfix: Stupid bug with URIs getting passed to merger
+
0.1.2-1 / 2012-01-30
==================
View
@@ -130,7 +130,7 @@ var minifyJS = function (str, concat) {
ast = uglifyjs.ast_squeeze(ast);
concat(uglifyjs.gen_code(ast)+";");
} catch (e) {
- console.log(e);
+ //console.log(e);
concat(str);
}
}
@@ -139,9 +139,8 @@ var minifyCSS = function (str, concat) {
try {
concat(csso.justDoIt(str)+"\n");
} catch (e) {
- console.log(e);
- //concat(str);
- throw Error("BOO!");
+ //console.log(e);
+ concat(str);
}
}
@@ -187,20 +186,24 @@ module.exports.middleware = function (backend, dirPath, options) {
var name = '/'+subDir+'/'+group+'.min.'+(outputExt || ext)+(gzipit ? '.gz' : ''),
merger = new Merger(dirPath+name);
- var flow = Flow();
-
+ var flow = Flow(),
+ processable = false;
groups[type][group].forEach(function(file) {
flow.seq(function(next) {
console.log("resmin: Processing: "+file);
// if no merge/minify or if file is an uri
- if ((!merge && !minify) || file.match(/^(http[s]?:\/\/|\/\/)/i)) {
+ var isURI = file.match(/^(http[s]?:\/\/|\/\/)/i);
+ if ((!merge && !minify) || isURI) {
out.push(file);
if (gzipit) {
output.gzip[type][group] = out;
}
output.plain[type][group] = out;
+ if (!isURI)
+ processable = true;
return next();
}
+ processable = true;
try {
var stat = fs.statSync(dirPath+file);
@@ -256,14 +259,15 @@ module.exports.middleware = function (backend, dirPath, options) {
});
flow.seq(function(next){
- if (merge) {
+ if (processable && merge) {
console.log("resmin: Merging: "+name);
if (out.indexOf(name) === -1)
out.push(name);
merger.process(processor);
}
if (gzipit) {
- console.log("resmin: Compressing: "+out);
+ if (processable)
+ console.log("resmin: Compressing: "+out);
output.gzip[type][group] = out;
}
output.plain[type][group] = out;
@@ -396,12 +400,15 @@ module.exports.middleware = function (backend, dirPath, options) {
}
if (filename.substring(filename.length-3) === '.gz') {
- contentType = mime.lookup(filename.substring(0, filename.length-3));
- charset = mime.charsets.lookup(contentType);
- etag(req, res, filename, function(stat){
- fs.readFile(filename, function (err, data) {
- if (err) throw err;
- sendGzipped(data);
+ fs.stat(filename, function(err, stat) {
+ if (err) return next();
+ contentType = mime.lookup(filename.substring(0, filename.length-3));
+ charset = mime.charsets.lookup(contentType);
+ etag(req, res, filename, function(stat){
+ fs.readFile(filename, function (err, data) {
+ if (err) throw err;
+ sendGzipped(data);
+ });
});
});
} else {
View
@@ -1,6 +1,6 @@
{
"name": "resmin",
- "version": "0.1.2-1",
+ "version": "0.1.2-2",
"author": "Marcus Ekwall <marcus.ekwall@gmail.com>",
"maintainer": "Marcus Ekwall",
"description": "All-in-one compressor/merger/minifier middleware for connect/express",

0 comments on commit 218f0f2

Please sign in to comment.