Skip to content

Commit

Permalink
Fixing yeoman#586
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeper committed Oct 5, 2012
1 parent bdc24e4 commit f68a02a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tasks/usemin.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ module.exports = function(grunt) {

grunt.registerHelper('usemin:css', function(content, block, target) {
var indent = (block.split(linefeed)[0].match(/^\s*/) || [])[0];
return content.replace(block, indent + '<link rel="stylesheet" href="' + target + '"\/?>');
return content.replace(block, indent + '<link rel="stylesheet" href="' + target + '"\/>');
});

grunt.registerHelper('usemin:js', function(content, block, target) {
Expand Down
10 changes: 10 additions & 0 deletions test/test-usemin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,15 @@ describe('usemin', function() {
assert.ok( changed.match(/img[^\>]+src=['"]images\/misc\/2a436\.test\.png["']/) );
});
});
describe('usemin:css', function() {
it("should replace a block with link on furnished target", function() {
grunt.log.muted = true;
var block = " foo\nbar\nbaz";
var content = "before block\n" + block + "\nafter block";
var awaited = "before block\n <link rel=\"stylesheet\" href=\"foo\"/>\nafter block";
var changed = grunt.helper('usemin:css', content, block, 'foo');
assert.ok( changed == awaited );
});
});
});

0 comments on commit f68a02a

Please sign in to comment.