Skip to content

Commit

Permalink
Merge pull request #49 from LaurentGoderre/master
Browse files Browse the repository at this point in the history
Don't output CSS unit for value 0
  • Loading branch information
LaurentGoderre committed Dec 3, 2013
2 parents b46e81e + 84d2085 commit 8d35524
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tasks/sprites.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module.exports = function(grunt) {

fileContents += imageClasses + ' {' + '\n' + ' background: url("' + generateBackgroundImagePath() + '") no-repeat;\n' + '}\n\n';
imageData.heights.forEach(function (height, idx) {
fileContents += '.' + (classPrefix === '' ? '' : classPrefix + '-') + path.basename(images[idx].file, '.png') + ' {\n' + ' background-position: 0 ' + -height + 'px;\n' + '}\n\n';
fileContents += '.' + (classPrefix === '' ? '' : classPrefix + '-') + path.basename(images[idx].file, '.png') + ' {\n' + ' background-position: 0 ' + -height + ( height === 0 ? "" : 'px') + ';\n' + '}\n\n';
});

return fileContents;
Expand All @@ -78,7 +78,7 @@ module.exports = function(grunt) {

fileContents += "%" + placeholder + (scssSyntax ? ' {' : '') + '\n' + ' background: url("' + generateBackgroundImagePath() + '") no-repeat' + (scssSyntax ? ';\n }' : '') + '\n\n';
imageData.heights.forEach(function (height, idx) {
fileContents += '%' + (classPrefix === '' ? '' : classPrefix + '-') + path.basename(images[idx].file, '.png') + (scssSyntax ? ' {' : '') + '\n @extend ' + '%' + placeholder + (scssSyntax ? ' ;' : '') + '\n' + ' background-position: 0 ' + -height + 'px' + (scssSyntax ? ';\n }' : '') + '\n\n';
fileContents += '%' + (classPrefix === '' ? '' : classPrefix + '-') + path.basename(images[idx].file, '.png') + (scssSyntax ? ' {' : '') + '\n @extend ' + '%' + placeholder + (scssSyntax ? ' ;' : '') + '\n' + ' background-position: 0 ' + -height + ( height === 0 ? "" : 'px') + (scssSyntax ? ';\n }' : '') + '\n\n';
});

return fileContents;
Expand All @@ -90,7 +90,7 @@ module.exports = function(grunt) {

fileContents += "." + placeholder + ' {\n' + ' background: url("' + generateBackgroundImagePath() + '") no-repeat;\n }' + '\n\n';
imageData.heights.forEach(function (height, idx) {
fileContents += '.' + (classPrefix === '' ? '' : classPrefix + '-') + path.basename(images[idx].file, '.png') + ':extend(.' + placeholder + ') {\n' + ' background-position: 0 ' + -height + 'px;\n' + '}\n\n';
fileContents += '.' + (classPrefix === '' ? '' : classPrefix + '-') + path.basename(images[idx].file, '.png') + ':extend(.' + placeholder + ') {\n' + ' background-position: 0 ' + -height + ( height === 0 ? "" : 'px') + ';\n' + '}\n\n';
});

return fileContents;
Expand Down

0 comments on commit 8d35524

Please sign in to comment.