Permalink
Browse files

Fixing #586

  • Loading branch information...
1 parent 45c9d02 commit a88b0febabeff1acefc023ec1c3ead8be708a0c5 @sleeper committed Oct 5, 2012
Showing with 11 additions and 1 deletion.
  1. +1 −1 cli/tasks/usemin.js
  2. +10 −0 cli/test/test-usemin.js
View
@@ -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) {
View
@@ -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 a88b0fe

Please sign in to comment.