Skip to content

Commit

Permalink
Adding more elements to css output
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Archibald committed Jun 25, 2011
1 parent 1703671 commit e339897
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions www/assets/3/script/CssOutput.js
Expand Up @@ -21,21 +21,29 @@ spriteCow.CssOutput = (function() {
CssOutputProto.update = function() {
var indent = this.useTabs ? '\t' : ' ',
rect = this.rect,
output = this.selector + ' {\n';

$container = this._$container;

$container.empty()
.append( $('<span class="selector"/>').text(this.selector) )
.append(' {\n');

if (this.useBgUrl && this.backgroundFileName) {
output += indent + "background: url('" + this.path + this.backgroundFileName + "') no-repeat";
$container.append( indent + "background: url('" )
.append( $('<span class="path"/>').text( this.path ) )
.append( $('<span class="file"/>').text( this.backgroundFileName ) )
.append("') no-repeat");
}
else {
output += indent + "background-position:";
$container.append( indent + "background-position:" );
}

output += bgPosVal(rect.x) + bgPosVal(rect.y) + ';\n';
output += indent + 'width: ' + rect.width + 'px;\n';
output += indent + 'height: ' + rect.height + 'px;\n';
output += '}';
$container.append(
bgPosVal(rect.x) + bgPosVal(rect.y) + ';\n' +
indent + 'width: ' + rect.width + 'px;\n' +
indent + 'height: ' + rect.height + 'px;\n' +
'}'
);

this._$container.text(output);
};

return CssOutput;
Expand Down

0 comments on commit e339897

Please sign in to comment.