Skip to content

Commit

Permalink
[Sass] Document !guarded.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Mar 30, 2010
1 parent 8ca3be0 commit 34152fc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
17 changes: 17 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Expand Up @@ -20,6 +20,12 @@
it's possible that some properties will break.
If this happens, please report it to [the Sass mailing list](http://groups.google.com/group/haml).

* In addition, setting the default value of variables
with `||=` is now deprecated
and will be removed in Sass 3.2.
Instead, add `!default` to the end of the value.
See also [this changelog entry](#3-0-0-default-flag)

* The `!` prefix for variables is deprecated,
and will be removed in Sass 3.2.
Use `$` as a prefix instead.
Expand Down Expand Up @@ -130,6 +136,17 @@ is compiled to:
height: 250px;
margin-left: 9px; }

##### Variable Defaults

Since `=` is no longer used for variable assignment,
assigning defaults to variables with `||=` no longer makes sense.
Instead, the `!default` flag
should be added to the end of the variable value.
This syntax is meant to be similar to CSS's `!important` flag.
For example:

$var: 12px !default

#### Variable Prefix Character
{#3-0-0-dollar-prefix}

Expand Down
15 changes: 8 additions & 7 deletions doc-src/SASS_REFERENCE.md
Expand Up @@ -957,28 +957,29 @@ is compiled to:
p.foo {
border-color: blue; }

### Optional Assignment: `||:`
### Variable Defaults: `!default`

You can assign to variables if they aren't already assigned
using the `||:` assignment operator. This means that if the
variable has already been assigned to, it won't be re-assigned,
by adding the `!default` flag to the end of the value.
This means that if the variable has already been assigned to,
it won't be re-assigned,
but if it doesn't have a value yet, it will be given one.

For example:

{.sass-ex}
$content: "First content"
$content ||: "Second content?"
$new_content ||: "First time reference"
$content: "Second content?" !default
$new_content: "First time reference" !default

#main
content: $content
new-content: $new_content

{.scss-ex}
$content: "First content";
$content ||: "Second content?";
$new_content ||: "First time reference";
$content: "Second content?" !default;
$new_content: "First time reference" !default;

#main {
content: $content;
Expand Down

0 comments on commit 34152fc

Please sign in to comment.