haml 3.1.0.alpha.33 → 3.1.0.alpha.36
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +177 -2
- data/vendor/sass/doc-src/SASS_REFERENCE.md +140 -3
- data/vendor/sass/lib/sass/cache_stores.rb +14 -0
- data/vendor/sass/lib/sass/cache_stores/active_support.rb +28 -0
- data/vendor/sass/lib/sass/cache_stores/base.rb +84 -0
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +56 -0
- data/vendor/sass/lib/sass/cache_stores/memory.rb +51 -0
- data/vendor/sass/lib/sass/cache_stores/null.rb +25 -0
- data/vendor/sass/lib/sass/engine.rb +86 -25
- data/vendor/sass/lib/sass/exec.rb +10 -1
- data/vendor/sass/lib/sass/importers/rails.rb +75 -0
- data/vendor/sass/lib/sass/less.rb +1 -1
- data/vendor/sass/lib/sass/plugin/compiler.rb +4 -1
- data/vendor/sass/lib/sass/plugin/configuration.rb +4 -2
- data/vendor/sass/lib/sass/plugin/rack.rb +15 -2
- data/vendor/sass/lib/sass/plugin/rails.rb +89 -9
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +30 -2
- data/vendor/sass/lib/sass/script/css_parser.rb +1 -1
- data/vendor/sass/lib/sass/script/functions.rb +126 -5
- data/vendor/sass/lib/sass/script/lexer.rb +1 -1
- data/vendor/sass/lib/sass/script/list.rb +76 -0
- data/vendor/sass/lib/sass/script/literal.rb +10 -1
- data/vendor/sass/lib/sass/script/number.rb +1 -1
- data/vendor/sass/lib/sass/script/operation.rb +3 -2
- data/vendor/sass/lib/sass/script/parser.rb +25 -12
- data/vendor/sass/lib/sass/scss/css_parser.rb +0 -5
- data/vendor/sass/lib/sass/scss/parser.rb +46 -7
- data/vendor/sass/lib/sass/scss/static_parser.rb +1 -1
- data/vendor/sass/lib/sass/tree/charset_node.rb +37 -0
- data/vendor/sass/lib/sass/tree/directive_node.rb +2 -2
- data/vendor/sass/lib/sass/tree/each_node.rb +54 -0
- data/vendor/sass/lib/sass/tree/if_node.rb +19 -0
- data/vendor/sass/lib/sass/tree/media_node.rb +75 -0
- data/vendor/sass/lib/sass/tree/prop_node.rb +1 -1
- data/vendor/sass/lib/sass/tree/root_node.rb +37 -5
- data/vendor/sass/lib/sass/tree/rule_node.rb +4 -6
- data/vendor/sass/lib/sass/util.rb +18 -1
- data/vendor/sass/test/sass/cache_test.rb +7 -7
- data/vendor/sass/test/sass/conversion_test.rb +28 -0
- data/vendor/sass/test/sass/engine_test.rb +214 -11
- data/vendor/sass/test/sass/functions_test.rb +69 -0
- data/vendor/sass/test/sass/plugin_test.rb +13 -4
- data/vendor/sass/test/sass/results/import_charset.css +4 -0
- data/vendor/sass/test/sass/results/import_charset_1_8.css +4 -0
- data/vendor/sass/test/sass/results/import_charset_ibm866.css +4 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +27 -25
- data/vendor/sass/test/sass/script_test.rb +12 -1
- data/vendor/sass/test/sass/scss/css_test.rb +27 -8
- data/vendor/sass/test/sass/scss/scss_test.rb +77 -0
- data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +4 -0
- data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +4 -0
- data/vendor/sass/test/sass/templates/import_charset.sass +7 -0
- data/vendor/sass/test/sass/templates/import_charset_1_8.sass +4 -0
- data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +9 -0
- data/vendor/sass/test/sass/templates/script.sass +2 -2
- data/vendor/sass/test/test_helper.rb +8 -0
- metadata +27 -10
- data/REVISION +0 -1
- data/vendor/sass/lib/sass/cache_store.rb +0 -208
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.36
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.36
|
@@ -9,6 +9,9 @@
|
|
9
9
|
|
10
10
|
* Many performance optimizations have been made by [thedarkone](http://github.com/thedarkone).
|
11
11
|
|
12
|
+
* Allow selectors to contain extra commas to make them easier to modify.
|
13
|
+
Extra commas will be removed when the selectors are converted to CSS.
|
14
|
+
|
12
15
|
### Keyword Arguments
|
13
16
|
|
14
17
|
Both mixins and Sass functions now support the ability to pass in keyword arguments.
|
@@ -25,7 +28,7 @@ For example, with mixins:
|
|
25
28
|
And with functions:
|
26
29
|
|
27
30
|
p {
|
28
|
-
color: hsl($hue: 180, $saturation: 78%, lightness: 57%);
|
31
|
+
color: hsl($hue: 180, $saturation: 78%, $lightness: 57%);
|
29
32
|
}
|
30
33
|
|
31
34
|
Keyword arguments are of the form `$name: value` and come after normal arguments.
|
@@ -38,6 +41,117 @@ The argument names for the built-in functions are listed
|
|
38
41
|
Sass functions defined in Ruby can use the {Sass::Script::Functions.declare} method
|
39
42
|
to declare the names of the arguments they take.
|
40
43
|
|
44
|
+
### Lists
|
45
|
+
|
46
|
+
Lists are now a first-class data type in Sass,
|
47
|
+
alongside strings, numbers, colors, and booleans.
|
48
|
+
They can be assigned to variables, passed to mixins,
|
49
|
+
and used in CSS declarations.
|
50
|
+
Just like the other data types (except booleans),
|
51
|
+
Sass lists look just like their CSS counterparts.
|
52
|
+
They can be separated either by spaces (e.g. `1px 2px 0 10px`)
|
53
|
+
or by commas (e.g. `Helvetica, Arial, sans-serif`).
|
54
|
+
In addition, individual values count as single-item lists.
|
55
|
+
|
56
|
+
Lists won't behave any differently in Sass 3.1 than they did in 3.0.
|
57
|
+
However, you can now do more with them using the new {file:Sass/Script/Functions.html#list-functions list functions}:
|
58
|
+
|
59
|
+
* The {Sass::Script::Functions#nth `nth($list, $n)` function} returns the nth item in a list.
|
60
|
+
For example, `nth(1px 2px 10px, 2)` returns the second item, `2px`.
|
61
|
+
Note that lists in Sass start at 1, not at 0 like they do in some other languages.
|
62
|
+
|
63
|
+
* The {Sass::Script::Functions#join `join($list1, $list2)` function}
|
64
|
+
joins together two lists into one.
|
65
|
+
For example, `join(1px 2px, 10px 5px)` returns `1px 2px 10px 5px`.
|
66
|
+
|
67
|
+
* The {Sass::Script::Functions#append `append($list, $val)` function}
|
68
|
+
appends values to the end of a list.
|
69
|
+
For example, `append(1px 2px, 10px)` returns `1px 2px 10px`.
|
70
|
+
|
71
|
+
* The {Sass::Script::Functions#join `length($list)` function}
|
72
|
+
returns the length of a list.
|
73
|
+
For example, `length(1px 2px 10px 5px)` returns `4`.
|
74
|
+
|
75
|
+
For more details about lists see {file:SASS_REFERENCE.md#lists the reference}.
|
76
|
+
|
77
|
+
#### `@each`
|
78
|
+
|
79
|
+
There's also a new directive that makes use of lists.
|
80
|
+
The {file:SASS_REFERENCE.md#each-directive `@each` directive} assigns a variable to each item in a list in turn,
|
81
|
+
like `@for` does for numbers.
|
82
|
+
This is useful for writing a bunch of similar styles
|
83
|
+
without having to go to the trouble of creating a mixin.
|
84
|
+
For example:
|
85
|
+
|
86
|
+
@each $animal in puma, sea-slug, egret, salamander {
|
87
|
+
.#{$animal}-icon {
|
88
|
+
background-image: url('/images/#{$animal}.png');
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
is compiled to:
|
93
|
+
|
94
|
+
.puma-icon {
|
95
|
+
background-image: url('/images/puma.png'); }
|
96
|
+
.sea-slug-icon {
|
97
|
+
background-image: url('/images/sea-slug.png'); }
|
98
|
+
.egret-icon {
|
99
|
+
background-image: url('/images/egret.png'); }
|
100
|
+
.salamander-icon {
|
101
|
+
background-image: url('/images/salamander.png'); }
|
102
|
+
|
103
|
+
### `@media` Bubbling
|
104
|
+
|
105
|
+
Modern stylesheets often use `@media` rules to target styles
|
106
|
+
at certain sorts of devices, screen resolutions, or even orientations.
|
107
|
+
They're also useful for print and aural styling.
|
108
|
+
Unfortunately, it's annoying and repetitive to break the flow of a stylesheet
|
109
|
+
and add a `@media` rule containing selectors you've already written
|
110
|
+
just to tweak the style a little.
|
111
|
+
|
112
|
+
Thus, Sass 3.1 now allows you to nest `@media` rules within selectors.
|
113
|
+
It will automatically bubble them up to the top level,
|
114
|
+
putting all the selectors on the way inside the rule.
|
115
|
+
For example:
|
116
|
+
|
117
|
+
.sidebar {
|
118
|
+
width: 300px;
|
119
|
+
@media screen and (orientation: landscape) {
|
120
|
+
width: 500px;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
is compiled to:
|
125
|
+
|
126
|
+
.sidebar {
|
127
|
+
width: 300px;
|
128
|
+
}
|
129
|
+
@media screen and (orientation: landscape) {
|
130
|
+
.sidebar {
|
131
|
+
width: 500px;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
You can also nest `@media` directives within one another.
|
136
|
+
The queries will then be combined using the `and` operator.
|
137
|
+
For example:
|
138
|
+
|
139
|
+
@media screen {
|
140
|
+
.sidebar {
|
141
|
+
@media (orientation: landscape) {
|
142
|
+
width: 500px;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
is compiled to:
|
148
|
+
|
149
|
+
@media screen and (orientation: landscape) {
|
150
|
+
.sidebar {
|
151
|
+
width: 500px;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
41
155
|
### Backwards Incompatibilities -- Must Read!
|
42
156
|
|
43
157
|
* When `@import` is given a path without `.sass`, `.scss`, or `.css` extension,
|
@@ -49,10 +163,71 @@ to declare the names of the arguments they take.
|
|
49
163
|
This flag hasn't been necessary since Rails 2.0.
|
50
164
|
Existing Rails 2.0 installations will continue to work.
|
51
165
|
|
52
|
-
## 3.0.
|
166
|
+
## 3.0.25 (Unreleased)
|
167
|
+
|
168
|
+
* When displaying a Sass error in an imported stylesheet,
|
169
|
+
use the imported stylesheet's contents rather than the top-level stylesheet.
|
170
|
+
|
171
|
+
* Fix a bug that caused some lines with non-ASCII characters to be ignored in Ruby 1.8.
|
172
|
+
|
173
|
+
* Fix a bug where boolean operators (`and`, `or`, and `not`) wouldn't work at the end of a line
|
174
|
+
in a multiline SassScript expression.
|
175
|
+
|
176
|
+
## 3.0.24
|
177
|
+
|
178
|
+
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.24).
|
179
|
+
|
180
|
+
* Raise an error when `@else` appears without an `@if` in SCSS.
|
181
|
+
|
182
|
+
* Fix some cases where `@if` rules were causing the line numbers in error reports
|
183
|
+
to become incorrect.
|
184
|
+
|
185
|
+
* IronRuby compatibility. This is sort of a hack: IronRuby reports its version as 1.9,
|
186
|
+
but it doesn't support the encoding APIs, so we treat it as 1.8 instead.
|
187
|
+
|
188
|
+
* The `--quiet` option now silences informational output from `--update` and `--watch`.
|
189
|
+
|
190
|
+
## 3.0.23
|
191
|
+
|
192
|
+
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.23).
|
53
193
|
|
54
194
|
* Fix the error message for unloadable modules when running the executables under Ruby 1.9.2.
|
55
195
|
|
196
|
+
### `@charset` Change
|
197
|
+
|
198
|
+
The behavior of `@charset` has changed in version 3.0.23
|
199
|
+
in order to work around a bug in Safari,
|
200
|
+
where `@charset` declarations placed anywhere other than the beginning of the document
|
201
|
+
cause some CSS rules to be ignored.
|
202
|
+
This change also makes `@charset`s in imported files behave in a more useful way.
|
203
|
+
|
204
|
+
#### Ruby 1.9
|
205
|
+
|
206
|
+
When using Ruby 1.9, which keeps track of the character encoding of the Sass document internally,
|
207
|
+
`@charset` directive in the Sass stylesheet and any stylesheets it imports
|
208
|
+
are no longer directly output to the generated CSS.
|
209
|
+
They're still used for determining the encoding of the input and output stylesheets,
|
210
|
+
but they aren't rendered in the same way other directives are.
|
211
|
+
|
212
|
+
Instead, Sass adds a single `@charset` directive at the beginning of the output stylesheet
|
213
|
+
if necessary, whether or not the input stylesheet had a `@charset` directive.
|
214
|
+
It will add this directive if and only if the output stylesheet contains non-ASCII characters.
|
215
|
+
By default, the declared charset will be UTF-8,
|
216
|
+
but if the Sass stylesheet declares a different charset then that will be used instead if possible.
|
217
|
+
|
218
|
+
One important consequence of this scheme is that it's possible for a Sass file
|
219
|
+
to import partials with different encodings (e.g. one encoded as UTF-8 and one as IBM866).
|
220
|
+
The output will then be UTF-8, unless the importing stylesheet
|
221
|
+
declares a different charset.
|
222
|
+
|
223
|
+
#### Ruby 1.8
|
224
|
+
|
225
|
+
Ruby 1.8 doesn't have good support for encodings, so it uses a simpler but less accurate
|
226
|
+
scheme for figuring out what `@charset` declaration to use for the output stylesheet.
|
227
|
+
It just takes the first `@charset` declaration to appear in the stylesheet
|
228
|
+
or any of its imports and moves it to the beginning of the document.
|
229
|
+
This means that under Ruby 1.8 it's *not* safe to import files with different encodings.
|
230
|
+
|
56
231
|
## 3.0.22
|
57
232
|
|
58
233
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.22).
|
@@ -188,10 +188,10 @@ Available options are:
|
|
188
188
|
don't write to it if it doesn't.
|
189
189
|
|
190
190
|
{#cache_store-option} `:cache_store`
|
191
|
-
: If this is set to an instance of a subclass of {Sass::
|
191
|
+
: If this is set to an instance of a subclass of {Sass::CacheStores::Base},
|
192
192
|
that cache store will be used to store and retrieve
|
193
193
|
cached compilation results.
|
194
|
-
Defaults to a {Sass::
|
194
|
+
Defaults to a {Sass::CacheStores::Filesytem} that is
|
195
195
|
initialized using the [`:cache_location` option](#cache_location-option).
|
196
196
|
|
197
197
|
{#never_update-option} `:never_update`
|
@@ -343,6 +343,23 @@ Note that Sass does not support the obscure `UTF-32-2143`,
|
|
343
343
|
since Ruby does not have support for them
|
344
344
|
and they're highly unlikely to ever be used in practice.
|
345
345
|
|
346
|
+
#### Output Encoding
|
347
|
+
|
348
|
+
In general, Sass will try to encode the output stylesheet
|
349
|
+
using the same encoding as the input stylesheet.
|
350
|
+
In order for it to do this, though, the input stylesheet must have a `@charset` declaration;
|
351
|
+
otherwise, Sass will default to encoding the output stylesheet as UTF-8.
|
352
|
+
In addition, it will add a `@charset` declaration to the output
|
353
|
+
if it's not plain ASCII.
|
354
|
+
|
355
|
+
When other stylesheets with `@charset` declarations are `@import`ed,
|
356
|
+
Sass will convert them to the same encoding as the main stylesheet.
|
357
|
+
|
358
|
+
Note that Ruby 1.8 does not have good support for character encodings,
|
359
|
+
and so Sass behaves somewhat differently when running under it than under Ruby 1.9 and later.
|
360
|
+
In Ruby 1.8, Sass simply uses the first `@charset` declaration in the stylesheet
|
361
|
+
or any of the other stylesheets it `@import`s.
|
362
|
+
|
346
363
|
## CSS Extensions
|
347
364
|
|
348
365
|
### Nested Rules
|
@@ -589,6 +606,7 @@ SassScript supports four main data types:
|
|
589
606
|
* strings of text, with and without quotes (e.g. `"foo"`, `'bar'`, `baz`)
|
590
607
|
* colors (e.g. `blue`, `#04a3f9`, `rgba(255, 0, 0, 0.5)`)
|
591
608
|
* booleans (e.g. `true`, `false`)
|
609
|
+
* lists of values, separated by spaces or commas (e.g. `1.5em 1em 0 2em`, `Helvetica, Arial, sans-serif`)
|
592
610
|
|
593
611
|
SassScript also supports all other types of CSS property value,
|
594
612
|
such as Unicode ranges and `!important` declarations.
|
@@ -625,6 +643,42 @@ It's also worth noting that when using the [deprecated `=` property syntax](#sas
|
|
625
643
|
all strings are interpreted as unquoted,
|
626
644
|
regardless of whether or not they're written with quotes.
|
627
645
|
|
646
|
+
#### Lists
|
647
|
+
|
648
|
+
Lists are how Sass represents the values of CSS declarations
|
649
|
+
like `margin: 10px 15px 0 0` or `font-face: Helvetica, Arial, sans-serif`.
|
650
|
+
Lists are just a series of other values, separated by either spaces or commas.
|
651
|
+
In fact, individual values count as lists, too: they're just lists with one item.
|
652
|
+
|
653
|
+
On their own, lists don't do much,
|
654
|
+
but the {file:Sass/Script/Functions.html#list-functions Sass list functions}
|
655
|
+
make them useful.
|
656
|
+
The {Sass::Script::Functions#nth nth function} can access items in a list,
|
657
|
+
the {Sass::Script::Functions#join join function} can join multiple lists together,
|
658
|
+
and the {Sass::Script::Functions#append append function} can add items to lists.
|
659
|
+
The [`@each` rule](#each-directive) can also add styles for each item in a list.
|
660
|
+
|
661
|
+
In addition to containing simple values, lists can contain other lists.
|
662
|
+
For example, `1px 2px, 5px 6px` is a two-item list
|
663
|
+
containing the list `1px 2px` and the list `5px 6px`.
|
664
|
+
If the inner lists have the same separator as the outer list,
|
665
|
+
you'll need to use parentheses to make it clear
|
666
|
+
where the inner lists start and stop.
|
667
|
+
For example, `(1px 2px) (5px 6px)` is also a two-item list
|
668
|
+
containing the list `1px 2px` and the list `5px 6px`.
|
669
|
+
The difference is that the outer list is space-separated,
|
670
|
+
where before it was comma-separated.
|
671
|
+
|
672
|
+
When lists are turned into plain CSS, Sass doesn't add any parentheses,
|
673
|
+
since CSS doesn't understand them.
|
674
|
+
That means that `(1px 2px) (5px 6px)` and `1px 2px 5px 6px`
|
675
|
+
will look the same when they become CSS.
|
676
|
+
However, they aren't the same when they're Sass:
|
677
|
+
the first is a list containing two lists,
|
678
|
+
while the second is a list containing four numbers.
|
679
|
+
|
680
|
+
It's not possible to have a list with zero elements in Sass.
|
681
|
+
|
628
682
|
### Operations
|
629
683
|
|
630
684
|
All types support equality operations (`==` and `!=`).
|
@@ -833,6 +887,12 @@ is compiled to:
|
|
833
887
|
SassScript supports `and`, `or`, and `not` operators
|
834
888
|
for boolean values.
|
835
889
|
|
890
|
+
#### List Operations
|
891
|
+
|
892
|
+
Lists don't support any special operations.
|
893
|
+
Instead, they're manipulated using the
|
894
|
+
{file:Sass/Script/Functions.html#list-functions list functions}.
|
895
|
+
|
836
896
|
### Parentheses
|
837
897
|
|
838
898
|
Parentheses can be used to affect the order of operations:
|
@@ -1021,6 +1081,56 @@ and you can do
|
|
1021
1081
|
|
1022
1082
|
and `_colors.scss` would be imported.
|
1023
1083
|
|
1084
|
+
### `@media` {#media}
|
1085
|
+
|
1086
|
+
`@media` directives in Sass behave just like they do in plain CSS,
|
1087
|
+
with one extra capability: they can be nested in CSS rules.
|
1088
|
+
If a `@media` directive appears within a CSS rule,
|
1089
|
+
it will be bubbled up to the top level of the stylesheet,
|
1090
|
+
putting all the selectors on the way inside the rule.
|
1091
|
+
This makes it easy to add media-specific styles
|
1092
|
+
without having to repeat selectors
|
1093
|
+
or break the flow of the stylesheet.
|
1094
|
+
For example:
|
1095
|
+
|
1096
|
+
.sidebar {
|
1097
|
+
width: 300px;
|
1098
|
+
@media screen and (orientation: landscape) {
|
1099
|
+
width: 500px;
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
|
1103
|
+
is compiled to:
|
1104
|
+
|
1105
|
+
.sidebar {
|
1106
|
+
width: 300px;
|
1107
|
+
}
|
1108
|
+
@media screen and (orientation: landscape) {
|
1109
|
+
.sidebar {
|
1110
|
+
width: 500px;
|
1111
|
+
}
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
`@media` queries can also be nested within one another.
|
1115
|
+
The queries will then be combined using the `and` operator.
|
1116
|
+
For example:
|
1117
|
+
|
1118
|
+
@media screen {
|
1119
|
+
.sidebar {
|
1120
|
+
@media (orientation: landscape) {
|
1121
|
+
width: 500px;
|
1122
|
+
}
|
1123
|
+
}
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
is compiled to:
|
1127
|
+
|
1128
|
+
@media screen and (orientation: landscape) {
|
1129
|
+
.sidebar {
|
1130
|
+
width: 500px;
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
|
1024
1134
|
### `@extend` {#extend}
|
1025
1135
|
|
1026
1136
|
There are often cases when designing a page
|
@@ -1416,6 +1526,33 @@ is compiled to:
|
|
1416
1526
|
.item-3 {
|
1417
1527
|
width: 6em; }
|
1418
1528
|
|
1529
|
+
### `@each` {#each-directive}
|
1530
|
+
|
1531
|
+
The `@each` rule has the form `@each $var in <list>`.
|
1532
|
+
`$var` can be any variable name, like `$length` or `$name`,
|
1533
|
+
and `<list>` is a SassScript expression that returns a list.
|
1534
|
+
|
1535
|
+
The `@each` rule sets `$var` to each item in the list,
|
1536
|
+
then outputs the styles it contains using that value of `$var`.
|
1537
|
+
For example:
|
1538
|
+
|
1539
|
+
@each $animal in puma, sea-slug, egret, salamander {
|
1540
|
+
.#{$animal}-icon {
|
1541
|
+
background-image: url('/images/#{$animal}.png');
|
1542
|
+
}
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
is compiled to:
|
1546
|
+
|
1547
|
+
.puma-icon {
|
1548
|
+
background-image: url('/images/puma.png'); }
|
1549
|
+
.sea-slug-icon {
|
1550
|
+
background-image: url('/images/sea-slug.png'); }
|
1551
|
+
.egret-icon {
|
1552
|
+
background-image: url('/images/egret.png'); }
|
1553
|
+
.salamander-icon {
|
1554
|
+
background-image: url('/images/salamander.png'); }
|
1555
|
+
|
1419
1556
|
### `@while`
|
1420
1557
|
|
1421
1558
|
The `@while` directive takes a SassScript expression
|
@@ -1725,7 +1862,7 @@ on the filesystem indicated by [`:cache_location`](#cache_location-option). If y
|
|
1725
1862
|
cannot write to the filesystem or need to share cache across ruby processes or machines,
|
1726
1863
|
then you can define your own cache store and set the[`:cache_store`
|
1727
1864
|
option](#cache_store-option). For details on creating your own cache store, please
|
1728
|
-
see the {Sass::
|
1865
|
+
see the {Sass::CacheStores::Base source documentation}.
|
1729
1866
|
|
1730
1867
|
### Custom Importers
|
1731
1868
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
3
|
+
module Sass
|
4
|
+
# Sass cache stores are in charge of storing cached information,
|
5
|
+
# especially parse trees for Sass documents.
|
6
|
+
#
|
7
|
+
# User-created importers must inherit from {CacheStores::Base}.
|
8
|
+
module CacheStores
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'sass/cache_stores/base'
|
13
|
+
require 'sass/cache_stores/filesystem'
|
14
|
+
require 'sass/cache_stores/memory'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Sass
|
2
|
+
module CacheStores
|
3
|
+
# A cache store that wraps an ActiveSupport cache store.
|
4
|
+
# This is useful for integrating with an app that uses ActiveSupport,
|
5
|
+
# or for taking advantage of the wide variety of ActiveSupport cache backends.
|
6
|
+
#
|
7
|
+
# This is automatically used within Rails.
|
8
|
+
class ActiveSupport < Base
|
9
|
+
# @param store [::ActiveSupport::Cache::Store] The cache store to wrap.
|
10
|
+
def initialize(store)
|
11
|
+
@store = store
|
12
|
+
end
|
13
|
+
|
14
|
+
# @see Base#_retrieve
|
15
|
+
def _retrieve(key, version, sha)
|
16
|
+
return unless val = @store.fetch('_sass/' + key)
|
17
|
+
return unless val[:version] == version
|
18
|
+
return unless val[:sha] == sha
|
19
|
+
return val[:contents]
|
20
|
+
end
|
21
|
+
|
22
|
+
# @see Base#_store
|
23
|
+
def _store(key, version, sha, contents)
|
24
|
+
@store.write('_sass/' + key, :version => version, :sha => sha, :contents => contents)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|