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 45c9d02 commit a88b0fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/tasks/usemin.js
Expand Up @@ -308,7 +308,7 @@ module.exports = function(grunt) {


grunt.registerHelper('usemin:css', function(content, block, target) { grunt.registerHelper('usemin:css', function(content, block, target) {
var indent = (block.split(linefeed)[0].match(/^\s*/) || [])[0]; 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) { grunt.registerHelper('usemin:js', function(content, block, target) {
Expand Down
10 changes: 10 additions & 0 deletions cli/test/test-usemin.js
Expand Up @@ -37,5 +37,15 @@ describe('usemin', function() {
assert.ok( changed.match(/img[^\>]+src=['"]images\/misc\/2a436\.test\.png["']/) ); 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.