forked from postcss/postcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
100 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
# Property with trimmed and raw value (with comments and spaces) | ||
class Raw | ||
constructor: (@raw, @trimmed) -> | ||
# Return Raw only if it necessary | ||
@load: (value, raw) -> | ||
if raw? and value != raw | ||
new Raw(value, raw) | ||
else | ||
value | ||
|
||
constructor: (@value, @raw) -> | ||
|
||
# Set new trimmed value and mark property as changed | ||
set: (value) -> | ||
if @trimmed != value | ||
if @value != value | ||
@raw = @value | ||
@changed = true | ||
@trimmed = value | ||
@value = value | ||
|
||
# Stringify to CSS raw value if trimmed wasn’t changed | ||
stringify: (opts = { }) -> | ||
if not @changed | ||
@raw || '' | ||
else if not @raw | ||
(opts.before || '') + @trimmed + (opts.after || '') | ||
toString: -> | ||
if @changed | ||
@value || '' | ||
else | ||
(if @raw[0] == ' ' then ' ' else '') + | ||
@trimmed + | ||
(if @raw[-1..-1] == ' ' then ' ' else '') | ||
|
||
Raw.empty = new Raw() | ||
@raw || @value || '' | ||
|
||
module.exports = Raw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.