Skip to content

Commit

Permalink
Merge pull request #9 from bengourley/master
Browse files Browse the repository at this point in the history
Precedence issue
  • Loading branch information
Paul Serby committed May 22, 2012
2 parents dd5fd51 + 0c266ca commit 8689fc7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/compact.js
Expand Up @@ -69,7 +69,7 @@ module.exports.createCompact = function(options) {
for (var i = 0; i < paths.length; i++) {
if (path.existsSync(paths[i])) {
jsPath = paths[i];
continue;
break;
}
}

Expand Down
1 change: 1 addition & 0 deletions test/assets-alt/a.js
@@ -0,0 +1 @@
console.log("hello from alt!")
25 changes: 25 additions & 0 deletions test/compact.test.js
Expand Up @@ -359,5 +359,30 @@ describe('compact.js', function() {


});

it('should give higher precedence to the added srcPath', function (done) {

compact.addNamespace('alternative', altPath);
compact.ns.alternative.addJs('a.js');

var app = {
helpers: function (helper) {},
configure: function(fn) {
fn();
}
};

compact.js(['alternative'])({ app : app }, {}, function () {

var compacted = fs.readFileSync(destPath + '/alternative.js', 'utf8')
, raw = fs.readFileSync(altPath + '/a.js', 'utf8');

compacted.should.equal(raw);
done();

});

});

});
});

0 comments on commit 8689fc7

Please sign in to comment.