haml 3.1.0 → 3.1.1
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/VERSION +1 -1
- data/vendor/sass/Rakefile +22 -46
- data/vendor/sass/VERSION +1 -1
- data/vendor/sass/VERSION_NAME +1 -1
- data/vendor/sass/bin/scss +8 -0
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +125 -9
- data/vendor/sass/doc-src/SASS_REFERENCE.md +84 -8
- data/vendor/sass/lib/sass.rb +0 -3
- data/vendor/sass/lib/sass/cache_stores.rb +1 -0
- data/vendor/sass/lib/sass/cache_stores/base.rb +2 -2
- data/vendor/sass/lib/sass/cache_stores/chain.rb +33 -0
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +6 -4
- data/vendor/sass/lib/sass/cache_stores/memory.rb +8 -12
- data/vendor/sass/lib/sass/engine.rb +65 -56
- data/vendor/sass/lib/sass/environment.rb +5 -2
- data/vendor/sass/lib/sass/exec.rb +52 -21
- data/vendor/sass/lib/sass/importers/filesystem.rb +32 -9
- data/vendor/sass/lib/sass/less.rb +1 -1
- data/vendor/sass/lib/sass/plugin.rb +11 -1
- data/vendor/sass/lib/sass/plugin/compiler.rb +21 -12
- data/vendor/sass/lib/sass/plugin/rails.rb +8 -82
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +10 -10
- data/vendor/sass/lib/sass/railtie.rb +3 -2
- data/vendor/sass/lib/sass/script.rb +2 -25
- data/vendor/sass/lib/sass/script/color.rb +4 -15
- data/vendor/sass/lib/sass/script/funcall.rb +63 -19
- data/vendor/sass/lib/sass/script/functions.rb +257 -19
- data/vendor/sass/lib/sass/script/lexer.rb +1 -4
- data/vendor/sass/lib/sass/script/list.rb +2 -2
- data/vendor/sass/lib/sass/script/node.rb +0 -27
- data/vendor/sass/lib/sass/script/number.rb +1 -1
- data/vendor/sass/lib/sass/script/operation.rb +0 -5
- data/vendor/sass/lib/sass/script/parser.rb +30 -12
- data/vendor/sass/lib/sass/script/string.rb +2 -17
- data/vendor/sass/lib/sass/script/string_interpolation.rb +1 -0
- data/vendor/sass/lib/sass/scss/parser.rb +58 -18
- data/vendor/sass/lib/sass/scss/rx.rb +2 -1
- data/vendor/sass/lib/sass/scss/script_lexer.rb +1 -1
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +2 -3
- data/vendor/sass/lib/sass/selector/sequence.rb +3 -6
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +2 -3
- data/vendor/sass/lib/sass/tree/charset_node.rb +0 -15
- data/vendor/sass/lib/sass/tree/comment_node.rb +20 -71
- data/vendor/sass/lib/sass/tree/debug_node.rb +4 -22
- data/vendor/sass/lib/sass/tree/directive_node.rb +0 -52
- data/vendor/sass/lib/sass/tree/each_node.rb +8 -38
- data/vendor/sass/lib/sass/tree/extend_node.rb +12 -48
- data/vendor/sass/lib/sass/tree/for_node.rb +20 -51
- data/vendor/sass/lib/sass/tree/function_node.rb +27 -0
- data/vendor/sass/lib/sass/tree/if_node.rb +22 -57
- data/vendor/sass/lib/sass/tree/import_node.rb +0 -56
- data/vendor/sass/lib/sass/tree/media_node.rb +0 -43
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +12 -45
- data/vendor/sass/lib/sass/tree/mixin_node.rb +13 -124
- data/vendor/sass/lib/sass/tree/node.rb +18 -304
- data/vendor/sass/lib/sass/tree/prop_node.rb +24 -92
- data/vendor/sass/lib/sass/tree/return_node.rb +18 -0
- data/vendor/sass/lib/sass/tree/root_node.rb +4 -133
- data/vendor/sass/lib/sass/tree/rule_node.rb +21 -164
- data/vendor/sass/lib/sass/tree/variable_node.rb +14 -23
- data/vendor/sass/lib/sass/tree/visitors/base.rb +75 -0
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +134 -0
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +255 -0
- data/vendor/sass/lib/sass/tree/visitors/cssize.rb +175 -0
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +301 -0
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +216 -0
- data/vendor/sass/lib/sass/tree/warn_node.rb +4 -28
- data/vendor/sass/lib/sass/tree/while_node.rb +5 -35
- data/vendor/sass/lib/sass/util.rb +0 -50
- data/vendor/sass/sass.gemspec +1 -1
- data/vendor/sass/test/sass/conversion_test.rb +53 -102
- data/vendor/sass/test/sass/engine_test.rb +416 -540
- data/vendor/sass/test/sass/functions_test.rb +306 -4
- data/vendor/sass/test/sass/importer_test.rb +0 -22
- data/vendor/sass/test/sass/plugin_test.rb +51 -21
- data/vendor/sass/test/sass/results/if.css +3 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +0 -38
- data/vendor/sass/test/sass/script_test.rb +19 -4
- data/vendor/sass/test/sass/scss/scss_test.rb +32 -11
- data/vendor/sass/test/sass/templates/if.sass +11 -0
- data/vendor/sass/test/sass/templates/nested_import.sass +2 -0
- data/vendor/sass/test/sass/util_test.rb +0 -21
- data/vendor/sass/test/test_helper.rb +0 -3
- metadata +268 -258
- data/vendor/sass/bin/css2sass +0 -13
- data/vendor/sass/lib/sass/cache_stores/active_support.rb +0 -28
- data/vendor/sass/lib/sass/importers/rails.rb +0 -75
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.1
|
data/vendor/sass/Rakefile
CHANGED
@@ -11,7 +11,7 @@ task :default => :test
|
|
11
11
|
require 'rake/testtask'
|
12
12
|
|
13
13
|
Rake::TestTask.new do |t|
|
14
|
-
t.libs << '
|
14
|
+
t.libs << 'test'
|
15
15
|
test_files = FileList[scope('test/**/*_test.rb')]
|
16
16
|
test_files.exclude(scope('test/rails/*'))
|
17
17
|
test_files.exclude(scope('test/plugins/*'))
|
@@ -25,8 +25,12 @@ end
|
|
25
25
|
# before we load the gemspec.
|
26
26
|
desc "Build all the packages."
|
27
27
|
task :package => [:revision_file, :submodules, :permissions] do
|
28
|
+
version = get_version
|
29
|
+
File.open(scope('VERSION'), 'w') {|f| f.puts(version)}
|
28
30
|
load scope('sass.gemspec')
|
29
31
|
Gem::Builder.new(SASS_GEMSPEC).build
|
32
|
+
sh %{git checkout VERSION}
|
33
|
+
|
30
34
|
pkg = "#{SASS_GEMSPEC.name}-#{SASS_GEMSPEC.version}"
|
31
35
|
mkdir_p "pkg"
|
32
36
|
verbose(true) {mv "#{pkg}.gem", "pkg/#{pkg}.gem"}
|
@@ -65,7 +69,7 @@ at_exit { File.delete(scope('REVISION')) rescue nil }
|
|
65
69
|
desc "Install Sass as a gem. Use SUDO=1 to install with sudo."
|
66
70
|
task :install => [:package] do
|
67
71
|
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
|
68
|
-
sh %{#{'sudo ' if ENV["SUDO"]}#{gem} install --no-ri pkg/sass-#{
|
72
|
+
sh %{#{'sudo ' if ENV["SUDO"]}#{gem} install --no-ri pkg/sass-#{get_version}}
|
69
73
|
end
|
70
74
|
|
71
75
|
desc "Release a new Sass package to Rubyforge."
|
@@ -123,57 +127,29 @@ task :release_edge do
|
|
123
127
|
ensure_git_cleanup do
|
124
128
|
puts "#{'=' * 50} Running rake release_edge"
|
125
129
|
|
126
|
-
sh %{git checkout
|
127
|
-
sh %{git reset --hard origin/
|
128
|
-
sh %{git merge origin/master}
|
129
|
-
|
130
|
-
unless edge_version = bump_edge_version
|
131
|
-
puts "master is already a prerelease version, no use building an edge gem"
|
132
|
-
next
|
133
|
-
end
|
134
|
-
|
135
|
-
File.open(scope('EDGE_GEM_VERSION'), 'w') {|f| f.puts(edge_version)}
|
136
|
-
sh %{git commit -m "Bump edge gem version to #{edge_version}." EDGE_GEM_VERSION}
|
137
|
-
sh %{git push origin edge-gem}
|
138
|
-
|
139
|
-
# Package the edge gem with the proper version
|
140
|
-
File.open(scope('VERSION'), 'w') {|f| f.puts(edge_version)}
|
130
|
+
sh %{git checkout master}
|
131
|
+
sh %{git reset --hard origin/master}
|
141
132
|
sh %{rake package}
|
142
|
-
|
143
|
-
|
144
|
-
sh %{
|
145
|
-
sh %{gem push pkg/sass-#{edge_version}.gem}
|
133
|
+
version = get_version
|
134
|
+
sh %{rubyforge add_release sass sass "Bleeding Edge (v#{version})" pkg/sass-#{version}.gem}
|
135
|
+
sh %{gem push pkg/sass-#{version}.gem}
|
146
136
|
end
|
147
137
|
end
|
148
138
|
|
149
|
-
#
|
150
|
-
#
|
151
|
-
|
152
|
-
|
153
|
-
|
139
|
+
# Get the version string. If this is being installed from Git,
|
140
|
+
# this includes the proper prerelease version.
|
141
|
+
def get_version
|
142
|
+
written_version = File.read(scope('VERSION').strip)
|
143
|
+
return written_version unless File.exist?(scope('.git'))
|
144
|
+
|
154
145
|
# Get the current master branch version
|
155
|
-
version =
|
146
|
+
version = written_version.split('.')
|
156
147
|
version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
|
157
|
-
unless version.size == 5 # prerelease
|
158
|
-
raise "master version #{version.join('.')} is not a prerelease version"
|
159
|
-
end
|
160
|
-
|
161
|
-
# Bump the edge gem version
|
162
|
-
edge_version = File.read(scope('EDGE_GEM_VERSION')).strip.split('.')
|
163
|
-
edge_version.map! {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
|
164
|
-
|
165
|
-
if version[3] != "alpha"
|
166
|
-
return
|
167
|
-
elsif edge_version[0..2] != version[0..2]
|
168
|
-
# A new master branch version was released, reset the edge gem version
|
169
|
-
edge_version[0..2] = version[0..2]
|
170
|
-
edge_version[4] = 1
|
171
|
-
else
|
172
|
-
# Just bump the teeny version
|
173
|
-
edge_version[4] += 1
|
174
|
-
end
|
148
|
+
return written_version unless version.size == 5 && version[3] == "alpha" # prerelease
|
175
149
|
|
176
|
-
|
150
|
+
return written_version if (commit_count = `git log --pretty=oneline --first-parent stable.. | wc -l`).empty?
|
151
|
+
version[4] = commit_count.strip
|
152
|
+
version.join('.')
|
177
153
|
end
|
178
154
|
|
179
155
|
task :watch_for_update do
|
data/vendor/sass/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0
|
1
|
+
3.1.0
|
data/vendor/sass/VERSION_NAME
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Brainy Betty
|
@@ -3,15 +3,58 @@
|
|
3
3
|
* Table of contents
|
4
4
|
{:toc}
|
5
5
|
|
6
|
-
## 3.
|
6
|
+
## 3.1.0 (Unreleased)
|
7
7
|
|
8
8
|
* Add an {Sass::Script::Functions#invert `invert` function} that takes the inverse of colors.
|
9
9
|
|
10
|
+
* A new sass function called `if` can be used to emit one of two values
|
11
|
+
based on the truth value of the first argument.
|
12
|
+
For example, `if(true, 1px, 2px)` returns `1px` and `if(false, 1px, 2px)` returns `2px`.
|
13
|
+
|
14
|
+
* Compass users can now use the `--compass` flag
|
15
|
+
to make the Compass libraries available for import.
|
16
|
+
This will also load the Compass project configuration
|
17
|
+
if run from the project root.
|
18
|
+
|
10
19
|
* Many performance optimizations have been made by [thedarkone](http://github.com/thedarkone).
|
11
20
|
|
12
21
|
* Allow selectors to contain extra commas to make them easier to modify.
|
13
22
|
Extra commas will be removed when the selectors are converted to CSS.
|
14
23
|
|
24
|
+
* `@import` may now be used within CSS or `@media` rules.
|
25
|
+
The imported file will be treated as though it were nested within the rule.
|
26
|
+
Files with mixins may not be imported in nested contexts.
|
27
|
+
|
28
|
+
* If a comment starts with `!`, that comment will now be interpolated
|
29
|
+
(`#{...}` will be replaced with the resulting value of the expression
|
30
|
+
inside) and the comment will always be printed out in the generated CSS
|
31
|
+
file -- even with compressed output. This is useful for adding copyright
|
32
|
+
notices to your stylesheets.
|
33
|
+
|
34
|
+
* A new executable named `scss` is now available. It is exactly like the
|
35
|
+
`sass` executable except it defaults to assuming input is in the SCSS syntax.
|
36
|
+
Both programs will use the source file's extension to determine the syntax where
|
37
|
+
possible.
|
38
|
+
|
39
|
+
### Sass-based Functions
|
40
|
+
|
41
|
+
While it has always been possible to add functions to Sass with Ruby, this release adds the ability to define new functions within Sass files directly.
|
42
|
+
For example:
|
43
|
+
|
44
|
+
$grid-width: 40px;
|
45
|
+
$gutter-width: 10px;
|
46
|
+
|
47
|
+
@function grid-width($n) {
|
48
|
+
@return $n * $grid-width + ($n - 1) * $gutter-width;
|
49
|
+
}
|
50
|
+
|
51
|
+
#sidebar { width: grid-width(5); }
|
52
|
+
|
53
|
+
Becomes:
|
54
|
+
|
55
|
+
#sidebar {
|
56
|
+
width: 240px; }
|
57
|
+
|
15
58
|
### Keyword Arguments
|
16
59
|
|
17
60
|
Both mixins and Sass functions now support the ability to pass in keyword arguments.
|
@@ -41,6 +84,44 @@ The argument names for the built-in functions are listed
|
|
41
84
|
Sass functions defined in Ruby can use the {Sass::Script::Functions.declare} method
|
42
85
|
to declare the names of the arguments they take.
|
43
86
|
|
87
|
+
#### New Keyword Functions
|
88
|
+
|
89
|
+
The new keyword argument functionality enables new Sass color functions
|
90
|
+
that use keywords to encompass a large amount of functionality in one function.
|
91
|
+
|
92
|
+
* The {Sass::Script::Functions#adjust_color adjust-color} function works like the old
|
93
|
+
`lighten`, `saturate`, and `adjust-hue` methods.
|
94
|
+
It increases and/or decreases the values of a color's properties by fixed amounts.
|
95
|
+
For example, `adjust-color($color, $lightness: 10%)` is the same as `lighten($color, 10%)`:
|
96
|
+
it returns `$color` with its lightness increased by 10%.
|
97
|
+
|
98
|
+
* The {Sass::Script::Functions#scale_color scale_color} function
|
99
|
+
is similar to {Sass::Script::Functions#adjust adjust},
|
100
|
+
but instead of increasing and/or decreasing a color's properties by fixed amounts,
|
101
|
+
it scales them fluidly by percentages.
|
102
|
+
The closer the percentage is to 100% (or -100%),
|
103
|
+
the closer the new property value will be to its maximum (or minimum).
|
104
|
+
For example, `scale-color(hsl(120, 70, 80), $lightness: 50%)`
|
105
|
+
will change the lightness from 80% to 90%,
|
106
|
+
because 90% is halfway between 80% and 100%.
|
107
|
+
Similarly, `scale-color(hsl(120, 70, 50), $lightness: 50%)`
|
108
|
+
will change the lightness from 50% to 75%.
|
109
|
+
|
110
|
+
* The {Sass::Script::Functions#change_color change-color} function simply changes a color's properties
|
111
|
+
regardless of their old values.
|
112
|
+
For example `change-color($color, $lightness: 10%)` returns `$color` with 10% lightness,
|
113
|
+
and `change-color($color, $alpha: 0.7)` returns color with opacity 0.7.
|
114
|
+
|
115
|
+
Each keyword function accepts `$hue`, `$saturation`, `$value`,
|
116
|
+
`$red`, `$green`, `$blue`, and `$alpha` keywords,
|
117
|
+
with the exception of `scale-color()` which doesn't accept `$hue`.
|
118
|
+
These keywords modify the respective properties of the given color.
|
119
|
+
|
120
|
+
Each keyword function can modify multiple properties at once.
|
121
|
+
For example, `adjust-color($color, $lightness: 15%, $saturation: -10%)`
|
122
|
+
both lightens and desaturates `$color`.
|
123
|
+
HSL properties cannot be modified at the same time as RGB properties, though.
|
124
|
+
|
44
125
|
### Lists
|
45
126
|
|
46
127
|
Lists are now a first-class data type in Sass,
|
@@ -152,6 +233,19 @@ is compiled to:
|
|
152
233
|
}
|
153
234
|
}
|
154
235
|
|
236
|
+
### Nested `@import`
|
237
|
+
|
238
|
+
The `@import` statement can now be nested within other structures
|
239
|
+
such as CSS rules and `@media` rules. For example:
|
240
|
+
|
241
|
+
@media print {
|
242
|
+
@import "print";
|
243
|
+
}
|
244
|
+
|
245
|
+
This imports `print.scss` and places all rules so imported within the `@media print` block.
|
246
|
+
This makes it easier to create stylesheets for specific media or sections of the document
|
247
|
+
and distributing those stylesheets across multiple files.
|
248
|
+
|
155
249
|
### Backwards Incompatibilities -- Must Read!
|
156
250
|
|
157
251
|
* When `@import` is given a path without `.sass`, `.scss`, or `.css` extension,
|
@@ -163,7 +257,32 @@ is compiled to:
|
|
163
257
|
This flag hasn't been necessary since Rails 2.0.
|
164
258
|
Existing Rails 2.0 installations will continue to work.
|
165
259
|
|
166
|
-
|
260
|
+
* Removed deprecated support for ! prefixed variables. Use $ to prefix variables now.
|
261
|
+
|
262
|
+
* Removed the deprecated css2sass executable. Use sass-convert now.
|
263
|
+
|
264
|
+
* Removed support for the equals operator in variable assignment. Use : now.
|
265
|
+
|
266
|
+
* Removed the sass2 mode from sass-convert. Users who have to migrate from sass2
|
267
|
+
should install Sass 3.0 and quiet all deprecation warnings before installing Sass 3.1.
|
268
|
+
|
269
|
+
### Sass Internals
|
270
|
+
|
271
|
+
* It is now possible to define a custom importer that can be used to find imports using different import semantics than the default filesystem importer that Sass provides. For instance, you can use this to generate imports on the fly, look them up from a database, or implement different file naming conventions. See the {Sass::Importers::Base Importer Base class} for more information.
|
272
|
+
|
273
|
+
* It is now possible to define a custom cache store to allow for efficient caching of Sass files using alternative cache stores like memcached in environments where a writable filesystem is not available or where the cache need to be shared across many servers for dynamically generated stylesheet environments. See the {Sass::CacheStores::Base CacheStore Base class} for more information.
|
274
|
+
|
275
|
+
## 3.0.26 (Unreleased)
|
276
|
+
|
277
|
+
* Fix a performance bug in large SCSS stylesheets with many nested selectors.
|
278
|
+
This should dramatically decrease compilation time of such stylesheets.
|
279
|
+
|
280
|
+
* Upgrade the bundled FSSM to version 0.2.3.
|
281
|
+
This means `sass --watch` will work out of the box with Rubinius.
|
282
|
+
|
283
|
+
## 3.0.25
|
284
|
+
|
285
|
+
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.25).
|
167
286
|
|
168
287
|
* When displaying a Sass error in an imported stylesheet,
|
169
288
|
use the imported stylesheet's contents rather than the top-level stylesheet.
|
@@ -173,6 +292,8 @@ is compiled to:
|
|
173
292
|
* Fix a bug where boolean operators (`and`, `or`, and `not`) wouldn't work at the end of a line
|
174
293
|
in a multiline SassScript expression.
|
175
294
|
|
295
|
+
* When using `sass --update`, only update individual files when they've changed.
|
296
|
+
|
176
297
|
## 3.0.24
|
177
298
|
|
178
299
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.24).
|
@@ -182,11 +303,6 @@ is compiled to:
|
|
182
303
|
* Fix some cases where `@if` rules were causing the line numbers in error reports
|
183
304
|
to become incorrect.
|
184
305
|
|
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
306
|
## 3.0.23
|
191
307
|
|
192
308
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/3.0.23).
|
@@ -1385,7 +1501,7 @@ This is also available via the `--debug-info` command-line flag.
|
|
1385
1501
|
|
1386
1502
|
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.21).
|
1387
1503
|
|
1388
|
-
* Fix a few bugs in the git-revision-reporting in {
|
1504
|
+
* Fix a few bugs in the git-revision-reporting in {Sass::Version#version}.
|
1389
1505
|
In particular, it will still work if `git gc` has been called recently,
|
1390
1506
|
or if various files are missing.
|
1391
1507
|
|
@@ -1506,7 +1622,7 @@ There were no changes made to Sass between versions 2.2.18 and 2.2.19.
|
|
1506
1622
|
These changes only affect people defining their own Sass functions
|
1507
1623
|
using {Sass::Script::Functions}.
|
1508
1624
|
|
1509
|
-
*
|
1625
|
+
* Sass::Script::Color#value attribute is deprecated.
|
1510
1626
|
Use {Sass::Script::Color#rgb} instead.
|
1511
1627
|
The returned array is now frozen as well.
|
1512
1628
|
|
@@ -150,7 +150,7 @@ in `environment.rb` in Rails or `config.ru` in Rack...
|
|
150
150
|
|
151
151
|
...or by passing an options hash to {Sass::Engine#initialize}.
|
152
152
|
All relevant options are also available via flags
|
153
|
-
to the `sass` command-line
|
153
|
+
to the `sass` and `scss` command-line executables.
|
154
154
|
Available options are:
|
155
155
|
|
156
156
|
{#style-option} `:style`
|
@@ -191,7 +191,7 @@ Available options are:
|
|
191
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::CacheStores::
|
194
|
+
Defaults to a {Sass::CacheStores::Filesystem} that is
|
195
195
|
initialized using the [`:cache_location` option](#cache_location-option).
|
196
196
|
|
197
197
|
{#never_update-option} `:never_update`
|
@@ -309,14 +309,18 @@ Available options are:
|
|
309
309
|
: An option that's available for individual applications to set
|
310
310
|
to make data available to {Sass::Script::Functions custom Sass functions}.
|
311
311
|
|
312
|
-
{#sass2-option} `:sass2`
|
313
|
-
: Parses the document using semantics closer to that of Sass v2.
|
314
|
-
Currently, this just means that strings in mixin arguments
|
315
|
-
are treated as though they were in [an `=` context](#sass-script-strings).
|
316
|
-
|
317
312
|
{#quiet-option} `:quiet`
|
318
313
|
: When set to true, causes warnings to be disabled.
|
319
314
|
|
315
|
+
### Syntax Selection
|
316
|
+
|
317
|
+
The Sass command-line tool will use the file extension to determine which
|
318
|
+
syntax you are using, but there's not always a filename. The `sass`
|
319
|
+
command-line program defaults to the indented syntax but you can pass the
|
320
|
+
`--scss` option to it if the input should be interpreted as SCSS syntax.
|
321
|
+
Alternatively, you can use the `scss` command-line program which is exactly
|
322
|
+
like the `sass` program but it defaults to assuming the syntax is SCSS.
|
323
|
+
|
320
324
|
### Encodings
|
321
325
|
|
322
326
|
When running on Ruby 1.9 and later, Sass is aware of the character encoding of documents
|
@@ -541,6 +545,9 @@ is compiled to:
|
|
541
545
|
a {
|
542
546
|
color: green; }
|
543
547
|
|
548
|
+
When the first letter of a comment is `!`, the comment will be interpolated
|
549
|
+
and always rendered into css output even in compressed output modes. This is useful for adding Copyright notices to your generated CSS.
|
550
|
+
|
544
551
|
## SassScript {#sassscript}
|
545
552
|
|
546
553
|
In addition to the plain CSS property syntax,
|
@@ -677,7 +684,12 @@ However, they aren't the same when they're Sass:
|
|
677
684
|
the first is a list containing two lists,
|
678
685
|
while the second is a list containing four numbers.
|
679
686
|
|
680
|
-
|
687
|
+
Lists can also have no items in them at all.
|
688
|
+
These lists are represented as `()`.
|
689
|
+
They can't be output directly to CSS;
|
690
|
+
if you try to do e.g. `font-family: ()`, Sass will raise an error.
|
691
|
+
If a list contains empty lists, as in `1px 2px () 3px`,
|
692
|
+
the empty list will be removed before it's turned into CSS.
|
681
693
|
|
682
694
|
### Operations
|
683
695
|
|
@@ -1081,6 +1093,38 @@ and you can do
|
|
1081
1093
|
|
1082
1094
|
and `_colors.scss` would be imported.
|
1083
1095
|
|
1096
|
+
#### Nested `@import` {#nested-import}
|
1097
|
+
|
1098
|
+
Although most of the time it's most useful to just have `@import`s
|
1099
|
+
at the top level of the document,
|
1100
|
+
it is possible to include them within CSS rules and `@media` rules.
|
1101
|
+
Like a base-level `@import`, this includes the contents of the `@import`ed file.
|
1102
|
+
However, the imported rules will be nested in the same place as the original `@import`.
|
1103
|
+
|
1104
|
+
For example, if `example.scss` contains
|
1105
|
+
|
1106
|
+
.example {
|
1107
|
+
color: red;
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
then
|
1111
|
+
|
1112
|
+
#main {
|
1113
|
+
@import "example";
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
would compile to
|
1117
|
+
|
1118
|
+
#main .example {
|
1119
|
+
color: red;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
Directives that are only allowed at the base level of a document,
|
1123
|
+
like `@mixin` or `@charset`, are not allowed in files that are `@import`ed
|
1124
|
+
in a nested context.
|
1125
|
+
|
1126
|
+
It's not possible to nest `@import` within mixins or control directives.
|
1127
|
+
|
1084
1128
|
### `@media` {#media}
|
1085
1129
|
|
1086
1130
|
`@media` directives in Sass behave just like they do in plain CSS,
|
@@ -1760,6 +1804,38 @@ providing many arguments without becoming difficult to call.
|
|
1760
1804
|
Named arguments can be passed in any order, and arguments with default values can be omitted.
|
1761
1805
|
Since the named arguments are variable names, underscores and dashes can be used interchangeably.
|
1762
1806
|
|
1807
|
+
## Function Directives {#functions}
|
1808
|
+
|
1809
|
+
It is possible to define your own functions in sass and use them in any
|
1810
|
+
value or script context. For example:
|
1811
|
+
|
1812
|
+
$grid-width: 40px;
|
1813
|
+
$gutter-width: 10px;
|
1814
|
+
|
1815
|
+
@function grid-width($n) {
|
1816
|
+
@return $n * $grid-width + ($n - 1) * $gutter-width;
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
#sidebar { width: grid-width(5); }
|
1820
|
+
|
1821
|
+
Becomes:
|
1822
|
+
|
1823
|
+
#sidebar {
|
1824
|
+
width: 240px; }
|
1825
|
+
|
1826
|
+
As you can see functions can access any globally defined variables as well as
|
1827
|
+
accept arguments just like a mixin. A function may have several statements
|
1828
|
+
contained within it, and you must call `@return` to set the return value of
|
1829
|
+
the function.
|
1830
|
+
|
1831
|
+
As with mixins, you can call Sass-defined functions using keyword arguments.
|
1832
|
+
In the above example we could have called the function like this:
|
1833
|
+
|
1834
|
+
#sidebar { width: grid-width($n: 5); }
|
1835
|
+
|
1836
|
+
It is recommended that you prefix your functions to avoid naming conflicts
|
1837
|
+
and so that readers of your stylesheets know they are not part of Sass or CSS. For example, if you work for ACME Corp, you might have named the function above `-acme-grid-width`.
|
1838
|
+
|
1763
1839
|
## Output Style
|
1764
1840
|
|
1765
1841
|
Although the default CSS style that Sass outputs is very nice
|