Permalink
Browse files

Fix issue #560 and #565

Treat the case of empty lines in blocks (#560)
as well as the filename collision (#565)
  • Loading branch information...
sleeper committed Sep 30, 2012
1 parent eb9123a commit e41faba96a3acf0dfceada00927676f7b8869dc4
Showing with 5 additions and 3 deletions.
  1. +5 −3 cli/tasks/usemin.js
View
@@ -231,7 +231,7 @@ module.exports = function(grunt) {
return asset;
}).reduce(function(a, b) {
- b = b.split(',');
+ b = ( b ? b.split(',') : '');
return a.concat(b);
}, []);
@@ -364,8 +364,10 @@ module.exports = function(grunt) {
var dirname = path.dirname(src);
// XXX files won't change, the filepath should filter the original list
- // of cached files.
- var filepath = grunt.file.expand(path.join('**/*') + basename)[0];
+ // of cached files (we need to treat the filename collision -- i.e. 2 files with same names
+ // in different subdirectories)
+ var filepaths = grunt.file.expand(path.join('**/*') + basename);
+ var filepath = filepaths.filter(function(f) { return(dirname == path.dirname(f));});
// not a file in temp, skip it
if ( !filepath ) {

0 comments on commit e41faba

Please sign in to comment.