sass 3.4.24 → 3.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CODE_OF_CONDUCT.md +1 -1
- data/CONTRIBUTING.md +3 -3
- data/README.md +17 -9
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/extra/sass-spec-ref.sh +9 -1
- data/lib/sass/cache_stores/filesystem.rb +1 -1
- data/lib/sass/css.rb +2 -3
- data/lib/sass/deprecation.rb +55 -0
- data/lib/sass/engine.rb +52 -34
- data/lib/sass/environment.rb +27 -6
- data/lib/sass/error.rb +2 -2
- data/lib/sass/exec/base.rb +2 -13
- data/lib/sass/exec/sass_scss.rb +1 -5
- data/lib/sass/features.rb +1 -0
- data/lib/sass/importers/filesystem.rb +6 -4
- data/lib/sass/logger/base.rb +11 -0
- data/lib/sass/plugin/compiler.rb +21 -51
- data/lib/sass/plugin/configuration.rb +2 -2
- data/lib/sass/plugin/rack.rb +2 -2
- data/lib/sass/plugin/staleness_checker.rb +1 -1
- data/lib/sass/plugin.rb +1 -1
- data/lib/sass/railtie.rb +1 -1
- data/lib/sass/script/css_parser.rb +4 -1
- data/lib/sass/script/functions.rb +310 -83
- data/lib/sass/script/lexer.rb +64 -10
- data/lib/sass/script/parser.rb +291 -121
- data/lib/sass/script/tree/funcall.rb +35 -34
- data/lib/sass/script/tree/interpolation.rb +0 -3
- data/lib/sass/script/tree/list_literal.rb +23 -8
- data/lib/sass/script/tree/map_literal.rb +2 -2
- data/lib/sass/script/tree/node.rb +1 -9
- data/lib/sass/script/tree/operation.rb +43 -23
- data/lib/sass/script/value/arg_list.rb +1 -1
- data/lib/sass/script/value/base.rb +18 -1
- data/lib/sass/script/value/callable.rb +25 -0
- data/lib/sass/script/value/color.rb +8 -2
- data/lib/sass/script/value/function.rb +19 -0
- data/lib/sass/script/value/helpers.rb +37 -11
- data/lib/sass/script/value/list.rb +35 -14
- data/lib/sass/script/value/map.rb +2 -2
- data/lib/sass/script/value/number.rb +3 -2
- data/lib/sass/script/value/string.rb +5 -12
- data/lib/sass/script/value.rb +2 -0
- data/lib/sass/script.rb +1 -1
- data/lib/sass/scss/css_parser.rb +6 -1
- data/lib/sass/scss/parser.rb +145 -56
- data/lib/sass/scss/rx.rb +5 -11
- data/lib/sass/scss/static_parser.rb +27 -42
- data/lib/sass/selector/abstract_sequence.rb +7 -6
- data/lib/sass/selector/comma_sequence.rb +21 -5
- data/lib/sass/selector/pseudo.rb +20 -3
- data/lib/sass/selector/sequence.rb +35 -10
- data/lib/sass/selector/simple.rb +10 -2
- data/lib/sass/selector/simple_sequence.rb +8 -4
- data/lib/sass/selector.rb +4 -0
- data/lib/sass/source/map.rb +2 -6
- data/lib/sass/stack.rb +21 -1
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/node.rb +2 -2
- data/lib/sass/tree/prop_node.rb +45 -53
- data/lib/sass/tree/rule_node.rb +13 -6
- data/lib/sass/tree/visitors/check_nesting.rb +1 -1
- data/lib/sass/tree/visitors/convert.rb +2 -3
- data/lib/sass/tree/visitors/cssize.rb +4 -15
- data/lib/sass/tree/visitors/deep_copy.rb +2 -2
- data/lib/sass/tree/visitors/extend.rb +2 -8
- data/lib/sass/tree/visitors/perform.rb +26 -17
- data/lib/sass/tree/visitors/set_options.rb +1 -1
- data/lib/sass/tree/visitors/to_css.rb +49 -22
- data/lib/sass/util/multibyte_string_scanner.rb +127 -131
- data/lib/sass/util/normalized_map.rb +1 -8
- data/lib/sass/util.rb +72 -310
- data/lib/sass/version.rb +0 -4
- data/lib/sass.rb +3 -10
- metadata +60 -206
- data/Rakefile +0 -424
- data/lib/sass/script/css_variable_warning.rb +0 -52
- data/lib/sass/util/cross_platform_random.rb +0 -19
- data/lib/sass/util/ordered_hash.rb +0 -192
- data/test/sass/cache_test.rb +0 -131
- data/test/sass/callbacks_test.rb +0 -61
- data/test/sass/compiler_test.rb +0 -236
- data/test/sass/conversion_test.rb +0 -2188
- data/test/sass/css2sass_test.rb +0 -526
- data/test/sass/css_variable_test.rb +0 -132
- data/test/sass/data/hsl-rgb.txt +0 -319
- data/test/sass/encoding_test.rb +0 -219
- data/test/sass/engine_test.rb +0 -3441
- data/test/sass/exec_test.rb +0 -96
- data/test/sass/extend_test.rb +0 -1727
- data/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/test/sass/functions_test.rb +0 -1974
- data/test/sass/importer_test.rb +0 -421
- data/test/sass/logger_test.rb +0 -58
- data/test/sass/mock_importer.rb +0 -49
- data/test/sass/more_results/more1.css +0 -9
- data/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/test/sass/more_results/more_import.css +0 -29
- data/test/sass/more_templates/_more_partial.sass +0 -2
- data/test/sass/more_templates/more1.sass +0 -23
- data/test/sass/more_templates/more_import.sass +0 -11
- data/test/sass/plugin_test.rb +0 -556
- data/test/sass/results/alt.css +0 -4
- data/test/sass/results/basic.css +0 -9
- data/test/sass/results/cached_import_option.css +0 -3
- data/test/sass/results/compact.css +0 -5
- data/test/sass/results/complex.css +0 -86
- data/test/sass/results/compressed.css +0 -1
- data/test/sass/results/expanded.css +0 -19
- data/test/sass/results/filename_fn.css +0 -3
- data/test/sass/results/if.css +0 -3
- data/test/sass/results/import.css +0 -31
- data/test/sass/results/import_charset.css +0 -5
- data/test/sass/results/import_charset_1_8.css +0 -5
- data/test/sass/results/import_charset_ibm866.css +0 -5
- data/test/sass/results/import_content.css +0 -1
- data/test/sass/results/line_numbers.css +0 -49
- data/test/sass/results/mixins.css +0 -95
- data/test/sass/results/multiline.css +0 -24
- data/test/sass/results/nested.css +0 -22
- data/test/sass/results/options.css +0 -1
- data/test/sass/results/parent_ref.css +0 -13
- data/test/sass/results/script.css +0 -16
- data/test/sass/results/scss_import.css +0 -31
- data/test/sass/results/scss_importee.css +0 -2
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/test/sass/results/subdir/subdir.css +0 -3
- data/test/sass/results/units.css +0 -11
- data/test/sass/results/warn.css +0 -0
- data/test/sass/results/warn_imported.css +0 -0
- data/test/sass/script_conversion_test.rb +0 -357
- data/test/sass/script_test.rb +0 -1422
- data/test/sass/scss/css_test.rb +0 -1281
- data/test/sass/scss/rx_test.rb +0 -160
- data/test/sass/scss/scss_test.rb +0 -4190
- data/test/sass/scss/test_helper.rb +0 -37
- data/test/sass/source_map_test.rb +0 -1055
- data/test/sass/superselector_test.rb +0 -210
- data/test/sass/templates/_cached_import_option_partial.scss +0 -1
- data/test/sass/templates/_double_import_loop2.sass +0 -1
- data/test/sass/templates/_filename_fn_import.scss +0 -11
- data/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/test/sass/templates/_imported_content.sass +0 -3
- data/test/sass/templates/_partial.sass +0 -2
- data/test/sass/templates/_same_name_different_partiality.scss +0 -1
- data/test/sass/templates/alt.sass +0 -16
- data/test/sass/templates/basic.sass +0 -23
- data/test/sass/templates/bork1.sass +0 -2
- data/test/sass/templates/bork2.sass +0 -2
- data/test/sass/templates/bork3.sass +0 -2
- data/test/sass/templates/bork4.sass +0 -2
- data/test/sass/templates/bork5.sass +0 -3
- data/test/sass/templates/cached_import_option.scss +0 -3
- data/test/sass/templates/compact.sass +0 -17
- data/test/sass/templates/complex.sass +0 -305
- data/test/sass/templates/compressed.sass +0 -15
- data/test/sass/templates/double_import_loop1.sass +0 -1
- data/test/sass/templates/expanded.sass +0 -17
- data/test/sass/templates/filename_fn.scss +0 -18
- data/test/sass/templates/if.sass +0 -11
- data/test/sass/templates/import.sass +0 -12
- data/test/sass/templates/import_charset.sass +0 -9
- data/test/sass/templates/import_charset_1_8.sass +0 -6
- data/test/sass/templates/import_charset_ibm866.sass +0 -11
- data/test/sass/templates/import_content.sass +0 -4
- data/test/sass/templates/importee.less +0 -2
- data/test/sass/templates/importee.sass +0 -19
- data/test/sass/templates/line_numbers.sass +0 -13
- data/test/sass/templates/mixin_bork.sass +0 -5
- data/test/sass/templates/mixins.sass +0 -76
- data/test/sass/templates/multiline.sass +0 -20
- data/test/sass/templates/nested.sass +0 -25
- data/test/sass/templates/nested_bork1.sass +0 -2
- data/test/sass/templates/nested_bork2.sass +0 -2
- data/test/sass/templates/nested_bork3.sass +0 -2
- data/test/sass/templates/nested_bork4.sass +0 -2
- data/test/sass/templates/nested_import.sass +0 -2
- data/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/test/sass/templates/options.sass +0 -2
- data/test/sass/templates/parent_ref.sass +0 -25
- data/test/sass/templates/same_name_different_ext.sass +0 -2
- data/test/sass/templates/same_name_different_ext.scss +0 -1
- data/test/sass/templates/same_name_different_partiality.scss +0 -1
- data/test/sass/templates/script.sass +0 -101
- data/test/sass/templates/scss_import.scss +0 -12
- data/test/sass/templates/scss_importee.scss +0 -1
- data/test/sass/templates/single_import_loop.sass +0 -1
- data/test/sass/templates/subdir/import_up1.scss +0 -1
- data/test/sass/templates/subdir/import_up2.scss +0 -1
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/test/sass/templates/subdir/subdir.sass +0 -6
- data/test/sass/templates/units.sass +0 -11
- data/test/sass/templates/warn.sass +0 -3
- data/test/sass/templates/warn_imported.sass +0 -4
- data/test/sass/test_helper.rb +0 -8
- data/test/sass/util/multibyte_string_scanner_test.rb +0 -147
- data/test/sass/util/normalized_map_test.rb +0 -51
- data/test/sass/util/subset_map_test.rb +0 -91
- data/test/sass/util_test.rb +0 -438
- data/test/sass/value_helpers_test.rb +0 -179
- data/test/sass-spec.yml +0 -3
- data/test/test_helper.rb +0 -110
- data/vendor/listen/CHANGELOG.md +0 -1
- data/vendor/listen/CONTRIBUTING.md +0 -38
- data/vendor/listen/Gemfile +0 -20
- data/vendor/listen/Guardfile +0 -8
- data/vendor/listen/LICENSE +0 -20
- data/vendor/listen/README.md +0 -349
- data/vendor/listen/Rakefile +0 -5
- data/vendor/listen/Vagrantfile +0 -96
- data/vendor/listen/lib/listen/adapter.rb +0 -327
- data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
- data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
- data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
- data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
- data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
- data/vendor/listen/lib/listen/directory_record.rb +0 -406
- data/vendor/listen/lib/listen/listener.rb +0 -323
- data/vendor/listen/lib/listen/turnstile.rb +0 -32
- data/vendor/listen/lib/listen/version.rb +0 -3
- data/vendor/listen/lib/listen.rb +0 -54
- data/vendor/listen/listen.gemspec +0 -28
- data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
- data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
- data/vendor/listen/spec/listen/listener_spec.rb +0 -258
- data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
- data/vendor/listen/spec/listen_spec.rb +0 -67
- data/vendor/listen/spec/spec_helper.rb +0 -25
- data/vendor/listen/spec/support/adapter_helper.rb +0 -666
- data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
- data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
- data/vendor/listen/spec/support/listeners_helper.rb +0 -179
- data/vendor/listen/spec/support/platform_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6442c161b5fc7709753d4bdc2a134f340af6d908
|
4
|
+
data.tar.gz: '0946cacd17612b438ce689b86cce9fa6a90bc208'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87b7eb8440a85957deaf8b83549d60fdb86f8c5f865aab9db67bee7ba8cd5c0985f05018c9a7ff18e1ea514aa2beb8dbca238257f76e6db14b9f6b1793bf4388
|
7
|
+
data.tar.gz: 5c786b64db488ba61d018257943aeb1ab9365c2e7069201ae0a5759fdbe6576f36d57a885ea690824d15d398d2c8c656fb21be0460ca5f6b088f2e10cfd1edee
|
data/CODE_OF_CONDUCT.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Contributions are welcomed. Please see the following site for guidelines:
|
2
2
|
|
3
|
-
[
|
3
|
+
[https://sass-lang.com/community#Contribute](https://sass-lang.com/community#Contribute)
|
4
4
|
|
5
5
|
* [Branches](#main-development-branches)
|
6
6
|
* [Feature Branches](#feature-branches)
|
@@ -18,7 +18,7 @@ is regularly merged into the one below: `stable` into `next`, `next` into
|
|
18
18
|
`master`.
|
19
19
|
|
20
20
|
* The `stable` branch is the default—it's what GitHub shows if you go to
|
21
|
-
[sass/sass](https://github.com/sass/sass), and it's the default place for pull
|
21
|
+
[sass/ruby-sass](https://github.com/sass/ruby-sass), and it's the default place for pull
|
22
22
|
requests to go. This branch is where we work on the next patch release. Bug
|
23
23
|
fixes and documentation improvements belong here, but not new features.
|
24
24
|
|
@@ -100,7 +100,7 @@ like [`Sass::Engine`][Sass::Engine] stable, we don't have a strong distinction
|
|
100
100
|
between public and private APIs and we need to be able to freely refactor our
|
101
101
|
code.
|
102
102
|
|
103
|
-
[Sass::Engine]:
|
103
|
+
[Sass::Engine]: https://sass-lang.com/documentation/Sass/Engine.html
|
104
104
|
|
105
105
|
### Making Breaking Changes
|
106
106
|
|
data/README.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
## Ruby Sass Has Reached End-of-Life
|
2
|
+
|
3
|
+
Ruby Sass should no longer be used, and will no longer be receiving any updates.
|
4
|
+
See [the Sass blog][], and consider switching to the [`sassc` gem].
|
5
|
+
|
6
|
+
[the Sass blog]: https://sass-lang.com/blog/posts/7828841
|
7
|
+
[`sassc` gem]: https://rubygems.org/gems/sassc
|
8
|
+
|
9
|
+
# Sass [![Travis Build Status](https://travis-ci.org/sass/ruby-sass.svg?branch=next)](https://travis-ci.org/sass/ruby-sass) [![Gem Version](https://badge.fury.io/rb/sass.svg)](http://badge.fury.io/rb/sass) [![Inline docs](http://inch-ci.org/github/sass/sass.svg)](http://inch-ci.org/github/sass/sass)
|
2
10
|
|
3
11
|
**Sass makes CSS fun again**. Sass is an extension of CSS,
|
4
12
|
adding nested rules, variables, mixins, selector inheritance, and more.
|
@@ -44,7 +52,7 @@ In Rails 3, add `gem "sass"` to your Gemfile instead.
|
|
44
52
|
where they'll be automatically compiled
|
45
53
|
to corresponding CSS files in `public/stylesheets` when needed
|
46
54
|
(the Sass template directory is customizable...
|
47
|
-
see [the Sass reference](
|
55
|
+
see [the Sass reference](https://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#template_location-option) for details).
|
48
56
|
|
49
57
|
Sass can also be used with any Rack-enabled web framework.
|
50
58
|
To do so, just add
|
@@ -59,7 +67,7 @@ Then any Sass files in `public/stylesheets/sass`
|
|
59
67
|
will be compiled into CSS files in `public/stylesheets` on every request.
|
60
68
|
|
61
69
|
To use Sass programmatically,
|
62
|
-
check out the [YARD documentation](
|
70
|
+
check out the [YARD documentation](https://sass-lang.com/documentation/file.SASS_REFERENCE.html#using_sass).
|
63
71
|
|
64
72
|
## Formatting
|
65
73
|
|
@@ -73,10 +81,10 @@ and get small stylesheets up and running quickly,
|
|
73
81
|
particularly with the help of
|
74
82
|
[the Compass style library](http://compass-style.org).
|
75
83
|
|
76
|
-
[vars]:
|
77
|
-
[nested]:
|
78
|
-
[mixins]:
|
79
|
-
[imports]:
|
84
|
+
[vars]: https://sass-lang.com/documentation/file.SASS_REFERENCE.html#variables_
|
85
|
+
[nested]: https://sass-lang.com/documentation/file.SASS_REFERENCE.html#nested_rules
|
86
|
+
[mixins]: https://sass-lang.com/documentation/file.SASS_REFERENCE.html#mixins
|
87
|
+
[imports]: https://sass-lang.com/documentation/file.SASS_REFERENCE.html#import
|
80
88
|
|
81
89
|
Sass has two syntaxes.
|
82
90
|
The one presented here, known as "SCSS" (for "Sassy CSS"),
|
@@ -85,7 +93,7 @@ The other (older) syntax, known as the indented syntax or just "Sass",
|
|
85
93
|
is whitespace-sensitive and indentation-based.
|
86
94
|
For more information, see the [reference documentation][syntax].
|
87
95
|
|
88
|
-
[syntax]:
|
96
|
+
[syntax]: https://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax
|
89
97
|
|
90
98
|
To run the following examples and see the CSS they produce,
|
91
99
|
put them in a file called `test.scss` and run `sass test.scss`.
|
@@ -160,7 +168,7 @@ You can even give them arguments.
|
|
160
168
|
```
|
161
169
|
|
162
170
|
A comprehensive list of features is available
|
163
|
-
in the [Sass reference](
|
171
|
+
in the [Sass reference](https://sass-lang.com/documentation/file.SASS_REFERENCE.html).
|
164
172
|
|
165
173
|
## Executables
|
166
174
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4
|
1
|
+
3.7.4
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
04 April 2019 00:49:58 UTC
|
data/VERSION_NAME
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Bleeding Edge
|
data/extra/sass-spec-ref.sh
CHANGED
@@ -18,7 +18,15 @@ fi
|
|
18
18
|
|
19
19
|
>&2 echo "Fetching pull request $TRAVIS_PULL_REQUEST..."
|
20
20
|
|
21
|
-
|
21
|
+
url=https://api.github.com/repos/sass/ruby-sass/pulls/$TRAVIS_PULL_REQUEST
|
22
|
+
if [ -z "$GITHUB_AUTH" ]; then
|
23
|
+
>&2 echo "Fetching pull request info without authentication"
|
24
|
+
JSON=$(curl -L -sS $url)
|
25
|
+
else
|
26
|
+
>&2 echo "Fetching pull request info as sassbot"
|
27
|
+
JSON=$(curl -u "sassbot:$GITHUB_AUTH" -L -sS $url)
|
28
|
+
fi
|
29
|
+
>&2 echo "$JSON"
|
22
30
|
|
23
31
|
RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)"
|
24
32
|
|
@@ -52,7 +52,7 @@ module Sass
|
|
52
52
|
# @param key [String]
|
53
53
|
# @return [String] The path to the cache file.
|
54
54
|
def path_to(key)
|
55
|
-
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" %
|
55
|
+
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" % c.ord}
|
56
56
|
File.join(cache_location, key)
|
57
57
|
end
|
58
58
|
end
|
data/lib/sass/css.rb
CHANGED
@@ -18,7 +18,7 @@ module Sass
|
|
18
18
|
# that can be converted to Unicode.
|
19
19
|
# If the stylesheet contains an `@charset` declaration,
|
20
20
|
# that overrides the Ruby encoding
|
21
|
-
# (see {file:SASS_REFERENCE.md#
|
21
|
+
# (see {file:SASS_REFERENCE.md#Encodings the encoding documentation})
|
22
22
|
# @option options :old [Boolean] (false)
|
23
23
|
# Whether or not to output old property syntax
|
24
24
|
# (`:color blue` as opposed to `color: blue`).
|
@@ -51,8 +51,7 @@ module Sass
|
|
51
51
|
raise err
|
52
52
|
end
|
53
53
|
|
54
|
-
# Returns the original encoding of the document
|
55
|
-
# or `nil` under Ruby 1.8.
|
54
|
+
# Returns the original encoding of the document.
|
56
55
|
#
|
57
56
|
# @return [Encoding, nil]
|
58
57
|
# @raise [Encoding::UndefinedConversionError] if the source encoding
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Sass
|
2
|
+
# A deprecation warning that should only be printed once for a given line in a
|
3
|
+
# given file.
|
4
|
+
#
|
5
|
+
# A global Deprecation instance should be created for each type of deprecation
|
6
|
+
# warning, and `warn` should be called each time a warning is needed.
|
7
|
+
class Deprecation
|
8
|
+
@@allow_double_warnings = false
|
9
|
+
|
10
|
+
# Runs a block in which double deprecation warnings for the same location
|
11
|
+
# are allowed.
|
12
|
+
def self.allow_double_warnings
|
13
|
+
old_allow_double_warnings = @@allow_double_warnings
|
14
|
+
@@allow_double_warnings = true
|
15
|
+
yield
|
16
|
+
ensure
|
17
|
+
@@allow_double_warnings = old_allow_double_warnings
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize
|
21
|
+
# A set of filename, line pairs for which warnings have been emitted.
|
22
|
+
@seen = Set.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Prints `message` as a deprecation warning associated with `filename`,
|
26
|
+
# `line`, and optionally `column`.
|
27
|
+
#
|
28
|
+
# This ensures that only one message will be printed for each line of a
|
29
|
+
# given file.
|
30
|
+
#
|
31
|
+
# @overload warn(filename, line, message)
|
32
|
+
# @param filename [String, nil]
|
33
|
+
# @param line [Number]
|
34
|
+
# @param message [String]
|
35
|
+
# @overload warn(filename, line, column, message)
|
36
|
+
# @param filename [String, nil]
|
37
|
+
# @param line [Number]
|
38
|
+
# @param column [Number]
|
39
|
+
# @param message [String]
|
40
|
+
def warn(filename, line, column_or_message, message = nil)
|
41
|
+
return if !@@allow_double_warnings && @seen.add?([filename, line]).nil?
|
42
|
+
if message
|
43
|
+
column = column_or_message
|
44
|
+
else
|
45
|
+
message = column_or_message
|
46
|
+
end
|
47
|
+
|
48
|
+
location = "line #{line}"
|
49
|
+
location << ", column #{column}" if column
|
50
|
+
location << " of #{filename}" if filename
|
51
|
+
|
52
|
+
Sass::Util.sass_warn("DEPRECATION WARNING on #{location}:\n#{message}")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/sass/engine.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'set'
|
2
2
|
require 'digest/sha1'
|
3
3
|
require 'sass/cache_stores'
|
4
|
+
require 'sass/deprecation'
|
4
5
|
require 'sass/source/position'
|
5
6
|
require 'sass/source/range'
|
6
7
|
require 'sass/source/map'
|
@@ -79,7 +80,13 @@ module Sass
|
|
79
80
|
#
|
80
81
|
# `type`: `String`
|
81
82
|
# : The user-friendly name of the type of the callable.
|
82
|
-
|
83
|
+
#
|
84
|
+
# `origin`: `Symbol`
|
85
|
+
# : From whence comes the callable: `:stylesheet`, `:builtin`, `:css`
|
86
|
+
# A callable with an origin of `:stylesheet` was defined in the stylesheet itself.
|
87
|
+
# A callable with an origin of `:builtin` was defined in ruby.
|
88
|
+
# A callable (function) with an origin of `:css` returns a function call with arguments to CSS.
|
89
|
+
Callable = Struct.new(:name, :args, :splat, :environment, :tree, :has_content, :type, :origin)
|
83
90
|
|
84
91
|
# This class handles the parsing and compilation of the Sass template.
|
85
92
|
# Example usage:
|
@@ -89,6 +96,8 @@ module Sass
|
|
89
96
|
# output = sass_engine.render
|
90
97
|
# puts output
|
91
98
|
class Engine
|
99
|
+
@@old_property_deprecation = Deprecation.new
|
100
|
+
|
92
101
|
# A line of Sass code.
|
93
102
|
#
|
94
103
|
# `text`: `String`
|
@@ -168,7 +177,7 @@ module Sass
|
|
168
177
|
# default values and resolving aliases.
|
169
178
|
#
|
170
179
|
# @param options [{Symbol => Object}] The options hash;
|
171
|
-
# see {file:SASS_REFERENCE.md#
|
180
|
+
# see {file:SASS_REFERENCE.md#Options the Sass options documentation}
|
172
181
|
# @return [{Symbol => Object}] The normalized options hash.
|
173
182
|
# @private
|
174
183
|
def self.normalize_options(options)
|
@@ -222,7 +231,7 @@ module Sass
|
|
222
231
|
#
|
223
232
|
# @param filename [String] The path to the Sass or SCSS file
|
224
233
|
# @param options [{Symbol => Object}] The options hash;
|
225
|
-
# See {file:SASS_REFERENCE.md#
|
234
|
+
# See {file:SASS_REFERENCE.md#Options the Sass options documentation}.
|
226
235
|
# @return [Sass::Engine] The Engine for the given Sass or SCSS file.
|
227
236
|
# @raise [Sass::SyntaxError] if there's an error in the document.
|
228
237
|
def self.for_file(filename, options)
|
@@ -240,7 +249,7 @@ module Sass
|
|
240
249
|
end
|
241
250
|
|
242
251
|
# The options for the Sass engine.
|
243
|
-
# See {file:SASS_REFERENCE.md#
|
252
|
+
# See {file:SASS_REFERENCE.md#Options the Sass options documentation}.
|
244
253
|
#
|
245
254
|
# @return [{Symbol => Object}]
|
246
255
|
attr_reader :options
|
@@ -257,9 +266,9 @@ module Sass
|
|
257
266
|
# that can be converted to Unicode.
|
258
267
|
# If the template contains an `@charset` declaration,
|
259
268
|
# that overrides the Ruby encoding
|
260
|
-
# (see {file:SASS_REFERENCE.md#
|
269
|
+
# (see {file:SASS_REFERENCE.md#Encodings the encoding documentation})
|
261
270
|
# @param options [{Symbol => Object}] An options hash.
|
262
|
-
# See {file:SASS_REFERENCE.md#
|
271
|
+
# See {file:SASS_REFERENCE.md#Options the Sass options documentation}.
|
263
272
|
# @see {Sass::Engine.for_file}
|
264
273
|
# @see {Sass::Plugin}
|
265
274
|
def initialize(template, options = {})
|
@@ -313,8 +322,7 @@ module Sass
|
|
313
322
|
end
|
314
323
|
end
|
315
324
|
|
316
|
-
# Returns the original encoding of the document
|
317
|
-
# or `nil` under Ruby 1.8.
|
325
|
+
# Returns the original encoding of the document.
|
318
326
|
#
|
319
327
|
# @return [Encoding, nil]
|
320
328
|
# @raise [Encoding::UndefinedConversionError] if the source encoding
|
@@ -367,7 +375,7 @@ Error generating source map: couldn't determine public URL for "#{filename}".
|
|
367
375
|
Without a public URL, there's nothing for the source map to link to.
|
368
376
|
An importer was not set for this file.
|
369
377
|
ERR
|
370
|
-
elsif Sass::Util.
|
378
|
+
elsif Sass::Util.silence_sass_warnings do
|
371
379
|
sourcemap_dir = nil if @options[:sourcemap] == :file
|
372
380
|
importer.public_url(filename, sourcemap_dir).nil?
|
373
381
|
end
|
@@ -383,7 +391,7 @@ ERR
|
|
383
391
|
rendered << "\n" if rendered[-1] != ?\n
|
384
392
|
rendered << "\n" unless compressed
|
385
393
|
rendered << "/*# sourceMappingURL="
|
386
|
-
rendered <<
|
394
|
+
rendered << URI::DEFAULT_PARSER.escape(sourcemap_uri)
|
387
395
|
rendered << " */\n"
|
388
396
|
return rendered, sourcemap
|
389
397
|
end
|
@@ -491,7 +499,6 @@ END
|
|
491
499
|
lines
|
492
500
|
end
|
493
501
|
|
494
|
-
# @comment
|
495
502
|
def try_comment(line, last, tab_str, comment_tab_str, index)
|
496
503
|
return unless last && last.comment?
|
497
504
|
# Nested comment stuff must be at least one whitespace char deeper
|
@@ -517,10 +524,6 @@ MSG
|
|
517
524
|
nodes = []
|
518
525
|
while (line = arr[i]) && line.tabs >= base
|
519
526
|
if line.tabs > base
|
520
|
-
raise SyntaxError.new(
|
521
|
-
"The line was indented #{line.tabs - base} levels deeper than the previous line.",
|
522
|
-
:line => line.index) if line.tabs > base + 1
|
523
|
-
|
524
527
|
nodes.last.children, i = tree(arr, i)
|
525
528
|
else
|
526
529
|
nodes << line
|
@@ -625,6 +628,11 @@ WARNING
|
|
625
628
|
raise SyntaxError.new("Invalid property: \"#{line.text}\".",
|
626
629
|
:line => @line) if name.nil? || value.nil?
|
627
630
|
|
631
|
+
@@old_property_deprecation.warn(@options[:filename], @line, <<WARNING)
|
632
|
+
Old-style properties like "#{line.text}" are deprecated and will be an error in future versions of Sass.
|
633
|
+
Use "#{name}: #{value}" instead.
|
634
|
+
WARNING
|
635
|
+
|
628
636
|
value_start_offset = name_end_offset = name_start_offset + name.length
|
629
637
|
unless value.empty?
|
630
638
|
# +1 and -1 both compensate for the leading ':', which is part of line.text
|
@@ -687,7 +695,14 @@ WARNING
|
|
687
695
|
end
|
688
696
|
|
689
697
|
name = line.text[0...scanner.pos]
|
690
|
-
|
698
|
+
could_be_property =
|
699
|
+
if name.start_with?('--')
|
700
|
+
(scanned = scanner.scan(/\s*:/))
|
701
|
+
else
|
702
|
+
(scanned = scanner.scan(/\s*:(?:\s+|$)/))
|
703
|
+
end
|
704
|
+
|
705
|
+
if could_be_property # test for a property
|
691
706
|
offset += scanned.length
|
692
707
|
property = parse_property(name, res, scanner.rest, :new, line, offset)
|
693
708
|
property.name_source_range = ident_range
|
@@ -710,26 +725,33 @@ WARNING
|
|
710
725
|
end
|
711
726
|
end
|
712
727
|
|
713
|
-
# @comment
|
714
|
-
# rubocop:disable ParameterLists
|
715
728
|
def parse_property(name, parsed_name, value, prop, line, start_offset)
|
716
|
-
|
717
|
-
if
|
718
|
-
|
729
|
+
|
730
|
+
if name.start_with?('--')
|
731
|
+
unless line.children.empty?
|
732
|
+
raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath custom properties.",
|
733
|
+
:line => @line + 1)
|
734
|
+
end
|
735
|
+
|
736
|
+
parser = Sass::SCSS::Parser.new(value,
|
737
|
+
@options[:filename], @options[:importer],
|
738
|
+
@line, to_parser_offset(@offset))
|
739
|
+
parsed_value = parser.parse_declaration_value
|
740
|
+
end_offset = start_offset + value.length
|
741
|
+
elsif value.strip.empty?
|
742
|
+
parsed_value = [Sass::Script::Tree::Literal.new(Sass::Script::Value::String.new(""))]
|
719
743
|
end_offset = start_offset
|
720
744
|
else
|
721
|
-
expr = parse_script(value,
|
722
|
-
:offset => to_parser_offset(start_offset),
|
723
|
-
:css_variable => name.start_with?("--"))
|
745
|
+
expr = parse_script(value, :offset => to_parser_offset(start_offset))
|
724
746
|
end_offset = expr.source_range.end_pos.offset - 1
|
747
|
+
parsed_value = [expr]
|
725
748
|
end
|
726
|
-
|
727
|
-
node = Tree::PropNode.new(parse_interp(name), expr, prop)
|
749
|
+
node = Tree::PropNode.new(parse_interp(name), parsed_value, prop)
|
728
750
|
node.value_source_range = Sass::Source::Range.new(
|
729
751
|
Sass::Source::Position.new(line.index, to_parser_offset(start_offset)),
|
730
752
|
Sass::Source::Position.new(line.index, to_parser_offset(end_offset)),
|
731
753
|
@options[:filename], @options[:importer])
|
732
|
-
if value.strip.empty? && line.children.empty?
|
754
|
+
if !node.custom_property? && value.strip.empty? && line.children.empty?
|
733
755
|
raise SyntaxError.new(
|
734
756
|
"Invalid property: \"#{node.declaration}\" (no value)." +
|
735
757
|
node.pseudo_class_selector_message)
|
@@ -1012,8 +1034,6 @@ WARNING
|
|
1012
1034
|
values
|
1013
1035
|
end
|
1014
1036
|
|
1015
|
-
# @comment
|
1016
|
-
# rubocop:disable MethodLength
|
1017
1037
|
def parse_import_arg(scanner, offset)
|
1018
1038
|
return if scanner.eos?
|
1019
1039
|
|
@@ -1088,8 +1108,6 @@ WARNING
|
|
1088
1108
|
end
|
1089
1109
|
node
|
1090
1110
|
end
|
1091
|
-
# @comment
|
1092
|
-
# rubocop:enable MethodLength
|
1093
1111
|
|
1094
1112
|
def parse_mixin_directive(parent, line, root, value, offset)
|
1095
1113
|
parse_mixin_definition(line)
|
@@ -1146,9 +1164,9 @@ WARNING
|
|
1146
1164
|
end
|
1147
1165
|
|
1148
1166
|
def parse_script(script, options = {})
|
1149
|
-
line = options
|
1150
|
-
offset = options
|
1151
|
-
Script.parse(script, line, offset, @options
|
1167
|
+
line = options[:line] || @line
|
1168
|
+
offset = options[:offset] || @offset + 1
|
1169
|
+
Script.parse(script, line, offset, @options)
|
1152
1170
|
end
|
1153
1171
|
|
1154
1172
|
def format_comment_text(text, silent)
|
data/lib/sass/environment.rb
CHANGED
@@ -81,7 +81,7 @@ module Sass
|
|
81
81
|
inherited_hash_reader :function
|
82
82
|
|
83
83
|
# @param options [{Symbol => Object}] The options hash. See
|
84
|
-
# {file:SASS_REFERENCE.md#
|
84
|
+
# {file:SASS_REFERENCE.md#Options the Sass options documentation}.
|
85
85
|
# @param parent [Environment] See \{#parent}
|
86
86
|
def initialize(parent = nil, options = nil)
|
87
87
|
@parent = parent
|
@@ -175,6 +175,10 @@ module Sass
|
|
175
175
|
|
176
176
|
# A read-only wrapper for a lexical environment for SassScript.
|
177
177
|
class ReadOnlyEnvironment < BaseEnvironment
|
178
|
+
def initialize(parent = nil, options = nil)
|
179
|
+
super
|
180
|
+
@content_cached = nil
|
181
|
+
end
|
178
182
|
# The read-only environment of the caller of this environment's mixin or function.
|
179
183
|
#
|
180
184
|
# @see BaseEnvironment#caller
|
@@ -185,14 +189,31 @@ module Sass
|
|
185
189
|
@caller ||= env.is_a?(ReadOnlyEnvironment) ? env : ReadOnlyEnvironment.new(env, env.options)
|
186
190
|
end
|
187
191
|
|
188
|
-
# The
|
192
|
+
# The content passed to this environment. If the content's environment isn't already
|
193
|
+
# read-only, it's made read-only.
|
189
194
|
#
|
190
195
|
# @see BaseEnvironment#content
|
191
|
-
#
|
196
|
+
#
|
197
|
+
# @return {[Array<Sass::Tree::Node>, ReadOnlyEnvironment]?} The content nodes and
|
198
|
+
# the lexical environment of the content block.
|
199
|
+
# Returns `nil` when there is no content in this environment.
|
192
200
|
def content
|
193
|
-
|
194
|
-
|
195
|
-
|
201
|
+
# Return the cached content from a previous invocation if any
|
202
|
+
return @content if @content_cached
|
203
|
+
# get the content with a read-write environment from the superclass
|
204
|
+
read_write_content = super
|
205
|
+
if read_write_content
|
206
|
+
tree, env = read_write_content
|
207
|
+
# make the content's environment read-only
|
208
|
+
if env && !env.is_a?(ReadOnlyEnvironment)
|
209
|
+
env = ReadOnlyEnvironment.new(env, env.options)
|
210
|
+
end
|
211
|
+
@content_cached = true
|
212
|
+
@content = [tree, env]
|
213
|
+
else
|
214
|
+
@content_cached = true
|
215
|
+
@content = nil
|
216
|
+
end
|
196
217
|
end
|
197
218
|
end
|
198
219
|
|
data/lib/sass/error.rb
CHANGED
@@ -142,7 +142,7 @@ module Sass
|
|
142
142
|
msg = lines[0] + lines[1..-1].
|
143
143
|
map {|l| "\n" + (" " * "Error: ".size) + l}.join
|
144
144
|
"Error: #{msg}" +
|
145
|
-
|
145
|
+
sass_backtrace.each_with_index.map do |entry, i|
|
146
146
|
"\n #{i == 0 ? 'on' : 'from'} line #{entry[:line]}" +
|
147
147
|
" of #{entry[:filename] || default_filename}" +
|
148
148
|
(entry[:mixin] ? ", in `#{entry[:mixin]}'" : "")
|
@@ -186,7 +186,7 @@ END
|
|
186
186
|
section = e.sass_template.rstrip.split("\n")[min...line_num + 5]
|
187
187
|
return e.sass_backtrace_str if section.nil? || section.empty?
|
188
188
|
|
189
|
-
e.sass_backtrace_str + "\n\n" +
|
189
|
+
e.sass_backtrace_str + "\n\n" + section.each_with_index.
|
190
190
|
map {|line, i| "#{line_offset + min + i}: #{line}"}.join("\n")
|
191
191
|
end
|
192
192
|
end
|
data/lib/sass/exec/base.rb
CHANGED
@@ -14,7 +14,6 @@ module Sass::Exec
|
|
14
14
|
#
|
15
15
|
# @see #parse
|
16
16
|
def parse!
|
17
|
-
# rubocop:disable RescueException
|
18
17
|
begin
|
19
18
|
parse
|
20
19
|
rescue Exception => e
|
@@ -38,7 +37,6 @@ module Sass::Exec
|
|
38
37
|
exit 1
|
39
38
|
end
|
40
39
|
exit 0
|
41
|
-
# rubocop:enable RescueException
|
42
40
|
end
|
43
41
|
|
44
42
|
# Parses the command-line arguments and runs the executable.
|
@@ -90,18 +88,9 @@ module Sass::Exec
|
|
90
88
|
#
|
91
89
|
# @param opts [OptionParser]
|
92
90
|
def encoding_option(opts)
|
93
|
-
encoding_desc =
|
94
|
-
'Does not work in Ruby 1.8.'
|
95
|
-
else
|
96
|
-
'Specify the default encoding for input files.'
|
97
|
-
end
|
91
|
+
encoding_desc = 'Specify the default encoding for input files.'
|
98
92
|
opts.on('-E', '--default-encoding ENCODING', encoding_desc) do |encoding|
|
99
|
-
|
100
|
-
$stderr.puts "Specifying the encoding is not supported in ruby 1.8."
|
101
|
-
exit 1
|
102
|
-
else
|
103
|
-
Encoding.default_external = encoding
|
104
|
-
end
|
93
|
+
Encoding.default_external = encoding
|
105
94
|
end
|
106
95
|
end
|
107
96
|
|
data/lib/sass/exec/sass_scss.rb
CHANGED
@@ -92,7 +92,7 @@ END
|
|
92
92
|
end
|
93
93
|
|
94
94
|
opts.on("-v", "--version", "Print the Sass version.") do
|
95
|
-
puts("Sass #{Sass.version[:string]}")
|
95
|
+
puts("Ruby Sass #{Sass.version[:string]}")
|
96
96
|
exit
|
97
97
|
end
|
98
98
|
end
|
@@ -256,8 +256,6 @@ MESSAGE
|
|
256
256
|
Sass::Repl.new(@options).run
|
257
257
|
end
|
258
258
|
|
259
|
-
# @comment
|
260
|
-
# rubocop:disable MethodLength
|
261
259
|
def watch_or_update
|
262
260
|
require 'sass/plugin'
|
263
261
|
Sass::Plugin.options.merge! @options[:for_engine]
|
@@ -359,8 +357,6 @@ WARNING
|
|
359
357
|
|
360
358
|
Sass::Plugin.watch(files)
|
361
359
|
end
|
362
|
-
# @comment
|
363
|
-
# rubocop:enable MethodLength
|
364
360
|
|
365
361
|
def run
|
366
362
|
input = @options[:input]
|
data/lib/sass/features.rb
CHANGED
@@ -67,7 +67,7 @@ module Sass
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def public_url(name, sourcemap_directory)
|
70
|
-
file_pathname = Sass::Util.cleanpath(
|
70
|
+
file_pathname = Sass::Util.cleanpath(File.absolute_path(name, @root))
|
71
71
|
return Sass::Util.file_uri_from_path(file_pathname) if sourcemap_directory.nil?
|
72
72
|
|
73
73
|
sourcemap_pathname = Sass::Util.cleanpath(sourcemap_directory)
|
@@ -133,7 +133,7 @@ module Sass
|
|
133
133
|
|
134
134
|
REDUNDANT_DIRECTORY = /#{Regexp.escape(File::SEPARATOR)}\.#{Regexp.escape(File::SEPARATOR)}/
|
135
135
|
# Given a base directory and an `@import`ed name,
|
136
|
-
# finds an
|
136
|
+
# finds an existent file that matches the name.
|
137
137
|
#
|
138
138
|
# @param dir [String] The directory relative to which to search.
|
139
139
|
# @param name [String] The filename to search for.
|
@@ -154,7 +154,9 @@ module Sass
|
|
154
154
|
[Sass::Util.cleanpath(full_path).to_s, s]
|
155
155
|
end
|
156
156
|
end.flatten(1)
|
157
|
-
|
157
|
+
if found.empty? && split(name)[2].nil? && File.directory?("#{dir}/#{name}")
|
158
|
+
return find_real_file("#{dir}/#{name}", "index", options)
|
159
|
+
end
|
158
160
|
|
159
161
|
if found.size > 1 && !@same_name_warnings.include?(found.first.first)
|
160
162
|
found.each {|(f, _)| @same_name_warnings << f}
|
@@ -202,7 +204,7 @@ WARNING
|
|
202
204
|
|
203
205
|
def _find(dir, name, options)
|
204
206
|
full_filename, syntax = Sass::Util.destructure(find_real_file(dir, name, options))
|
205
|
-
return unless full_filename && File.readable?(full_filename)
|
207
|
+
return unless full_filename && File.file?(full_filename) && File.readable?(full_filename)
|
206
208
|
|
207
209
|
# TODO: this preserves historical behavior, but it's possible
|
208
210
|
# :filename should be either normalized to the native format
|
data/lib/sass/logger/base.rb
CHANGED
@@ -22,6 +22,17 @@ class Sass::Logger::Base
|
|
22
22
|
!disabled && self.class.log_level?(level, log_level)
|
23
23
|
end
|
24
24
|
|
25
|
+
# Captures all logger messages emitted during a block and returns them as a
|
26
|
+
# string.
|
27
|
+
def capture
|
28
|
+
old_io = io
|
29
|
+
self.io = StringIO.new
|
30
|
+
yield
|
31
|
+
io.string
|
32
|
+
ensure
|
33
|
+
self.io = old_io
|
34
|
+
end
|
35
|
+
|
25
36
|
def log(level, message)
|
26
37
|
_log(level, message) if logging_level?(level)
|
27
38
|
end
|