sass 3.4.0 → 3.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/CODE_OF_CONDUCT.md +10 -0
- data/CONTRIBUTING.md +148 -0
- data/MIT-LICENSE +1 -1
- data/README.md +26 -20
- data/Rakefile +103 -20
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/extra/sass-spec-ref.sh +32 -0
- data/extra/update_watch.rb +1 -1
- data/lib/sass/cache_stores/filesystem.rb +7 -7
- data/lib/sass/cache_stores/memory.rb +4 -5
- data/lib/sass/callbacks.rb +2 -2
- data/lib/sass/css.rb +11 -10
- data/lib/sass/deprecation.rb +55 -0
- data/lib/sass/engine.rb +83 -38
- data/lib/sass/environment.rb +26 -2
- data/lib/sass/error.rb +12 -12
- data/lib/sass/exec/base.rb +15 -3
- data/lib/sass/exec/sass_convert.rb +34 -15
- data/lib/sass/exec/sass_scss.rb +23 -7
- data/lib/sass/features.rb +2 -2
- data/lib/sass/importers/base.rb +1 -1
- data/lib/sass/importers/deprecated_path.rb +51 -0
- data/lib/sass/importers/filesystem.rb +24 -16
- data/lib/sass/importers.rb +1 -0
- data/lib/sass/logger/base.rb +8 -2
- data/lib/sass/logger/delayed.rb +50 -0
- data/lib/sass/logger.rb +8 -3
- data/lib/sass/plugin/compiler.rb +42 -25
- data/lib/sass/plugin/configuration.rb +38 -22
- data/lib/sass/plugin/merb.rb +2 -2
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/rails.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +3 -3
- data/lib/sass/plugin.rb +3 -2
- data/lib/sass/script/css_parser.rb +2 -3
- data/lib/sass/script/css_variable_warning.rb +52 -0
- data/lib/sass/script/functions.rb +140 -73
- data/lib/sass/script/lexer.rb +37 -22
- data/lib/sass/script/parser.rb +235 -40
- data/lib/sass/script/tree/funcall.rb +12 -5
- data/lib/sass/script/tree/interpolation.rb +109 -4
- data/lib/sass/script/tree/list_literal.rb +31 -4
- data/lib/sass/script/tree/literal.rb +4 -0
- data/lib/sass/script/tree/node.rb +21 -3
- data/lib/sass/script/tree/operation.rb +54 -1
- data/lib/sass/script/tree/string_interpolation.rb +58 -37
- data/lib/sass/script/tree/variable.rb +1 -1
- data/lib/sass/script/value/base.rb +10 -9
- data/lib/sass/script/value/color.rb +42 -24
- data/lib/sass/script/value/helpers.rb +16 -6
- data/lib/sass/script/value/map.rb +1 -1
- data/lib/sass/script/value/number.rb +52 -19
- data/lib/sass/script/value/string.rb +46 -5
- data/lib/sass/script.rb +3 -3
- data/lib/sass/scss/css_parser.rb +16 -2
- data/lib/sass/scss/parser.rb +120 -75
- data/lib/sass/scss/rx.rb +9 -10
- data/lib/sass/scss/static_parser.rb +19 -14
- data/lib/sass/scss.rb +0 -2
- data/lib/sass/selector/abstract_sequence.rb +8 -6
- data/lib/sass/selector/comma_sequence.rb +25 -9
- data/lib/sass/selector/pseudo.rb +45 -35
- data/lib/sass/selector/sequence.rb +54 -18
- data/lib/sass/selector/simple.rb +11 -11
- data/lib/sass/selector/simple_sequence.rb +34 -15
- data/lib/sass/selector.rb +7 -10
- data/lib/sass/shared.rb +1 -1
- data/lib/sass/source/map.rb +7 -4
- data/lib/sass/source/position.rb +4 -4
- data/lib/sass/stack.rb +2 -2
- data/lib/sass/supports.rb +8 -10
- data/lib/sass/tree/comment_node.rb +1 -1
- data/lib/sass/tree/css_import_node.rb +9 -1
- data/lib/sass/tree/function_node.rb +8 -3
- data/lib/sass/tree/import_node.rb +6 -5
- data/lib/sass/tree/node.rb +5 -3
- data/lib/sass/tree/prop_node.rb +5 -6
- data/lib/sass/tree/rule_node.rb +14 -4
- data/lib/sass/tree/visitors/check_nesting.rb +18 -22
- data/lib/sass/tree/visitors/convert.rb +43 -26
- data/lib/sass/tree/visitors/cssize.rb +5 -1
- data/lib/sass/tree/visitors/deep_copy.rb +1 -1
- data/lib/sass/tree/visitors/extend.rb +15 -13
- data/lib/sass/tree/visitors/perform.rb +42 -17
- data/lib/sass/tree/visitors/set_options.rb +1 -1
- data/lib/sass/tree/visitors/to_css.rb +58 -30
- data/lib/sass/util/multibyte_string_scanner.rb +0 -2
- data/lib/sass/util/normalized_map.rb +0 -1
- data/lib/sass/util/subset_map.rb +1 -2
- data/lib/sass/util.rb +125 -68
- data/lib/sass/version.rb +2 -2
- data/lib/sass.rb +10 -3
- data/test/sass/compiler_test.rb +6 -2
- data/test/sass/conversion_test.rb +187 -53
- data/test/sass/css2sass_test.rb +50 -1
- data/test/sass/css_variable_test.rb +132 -0
- data/test/sass/engine_test.rb +207 -61
- data/test/sass/exec_test.rb +10 -0
- data/test/sass/extend_test.rb +101 -29
- data/test/sass/functions_test.rb +60 -9
- data/test/sass/importer_test.rb +9 -0
- data/test/sass/more_templates/more1.sass +10 -10
- data/test/sass/more_templates/more_import.sass +2 -2
- data/test/sass/plugin_test.rb +10 -8
- data/test/sass/results/script.css +3 -3
- data/test/sass/script_conversion_test.rb +58 -29
- data/test/sass/script_test.rb +430 -53
- data/test/sass/scss/css_test.rb +73 -7
- data/test/sass/scss/rx_test.rb +4 -0
- data/test/sass/scss/scss_test.rb +309 -4
- data/test/sass/source_map_test.rb +152 -74
- data/test/sass/superselector_test.rb +19 -0
- data/test/sass/templates/_partial.sass +1 -1
- data/test/sass/templates/basic.sass +10 -10
- data/test/sass/templates/bork1.sass +1 -1
- data/test/sass/templates/bork5.sass +1 -1
- data/test/sass/templates/compact.sass +10 -10
- data/test/sass/templates/complex.sass +187 -187
- data/test/sass/templates/compressed.sass +10 -10
- data/test/sass/templates/expanded.sass +10 -10
- data/test/sass/templates/import.sass +2 -2
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/mixins.sass +22 -22
- data/test/sass/templates/multiline.sass +4 -4
- data/test/sass/templates/nested.sass +13 -13
- data/test/sass/templates/parent_ref.sass +12 -12
- data/test/sass/templates/script.sass +70 -70
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
- data/test/sass/templates/subdir/subdir.sass +3 -3
- data/test/sass/templates/units.sass +10 -10
- data/test/sass/util/multibyte_string_scanner_test.rb +10 -2
- data/test/sass/util_test.rb +15 -44
- data/test/sass-spec.yml +3 -0
- data/test/test_helper.rb +5 -4
- metadata +302 -295
- data/CONTRIBUTING +0 -3
- data/lib/sass/scss/script_lexer.rb +0 -15
- data/lib/sass/scss/script_parser.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8b2d6c079c8e8aec59e0dd45294419919f88239
|
4
|
+
data.tar.gz: 5e31ebbe100aa0b066d414ee32e3f29d792907f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1782f895c1aaeef19491dfb41434ca10a60d28395f53a3ec19f8a65ec21c97625db3325732007fbc3155821c53adf9bcd00ced70e9fe3c1c935295b34f3dfdaf
|
7
|
+
data.tar.gz: 39578a844dd4d6e381cb10ced82d5c6782ddd042c79cc5c4c9cc6a69163badbf1ce368526987447b955d44a3d20470ea5e4eae481ea9359d63eea09cab94ca70
|
data/.yardopts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
--readme README.md
|
2
2
|
--markup markdown
|
3
|
-
--markup-provider
|
3
|
+
--markup-provider redcarpet
|
4
4
|
--default-return ""
|
5
5
|
--title "Sass Documentation"
|
6
6
|
--query 'object.type != :classvariable'
|
@@ -9,3 +9,5 @@
|
|
9
9
|
--protected
|
10
10
|
--no-private
|
11
11
|
--no-highlight
|
12
|
+
--tag comment
|
13
|
+
--hide-tag comment
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Sass is more than a technology; Sass is driven by the community of individuals
|
2
|
+
that power its development and use every day. As a community, we want to embrace
|
3
|
+
the very differences that have made our collaboration so powerful, and work
|
4
|
+
together to provide the best environment for learning, growing, and sharing of
|
5
|
+
ideas. It is imperative that we keep Sass a fun, welcoming, challenging, and
|
6
|
+
fair place to play.
|
7
|
+
|
8
|
+
[The full community guidelines can be found on the Sass website.][link]
|
9
|
+
|
10
|
+
[link]: http://sass-lang.com/community-guidelines
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
Contributions are welcomed. Please see the following site for guidelines:
|
2
|
+
|
3
|
+
[http://sass-lang.com/community#Contribute](http://sass-lang.com/community#Contribute)
|
4
|
+
|
5
|
+
* [Branches](#main-development-branches)
|
6
|
+
* [Feature Branches](#feature-branches)
|
7
|
+
* [Experimental Branches](#experimental-branches)
|
8
|
+
* [Old Stable Branches](#old-stable-branches)
|
9
|
+
* [Versioning](#versioning)
|
10
|
+
* [Making Breaking Changes](#making-breaking-changes)
|
11
|
+
* [Exceptional Breakages](#exceptional-breakages)
|
12
|
+
|
13
|
+
## Branches
|
14
|
+
|
15
|
+
The Sass repository has three primary development branches, each of which tracks
|
16
|
+
a different line of releases (see [versioning](#versioning) below). Each branch
|
17
|
+
is regularly merged into the one below: `stable` into `next`, `next` into
|
18
|
+
`master`.
|
19
|
+
|
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
|
22
|
+
requests to go. This branch is where we work on the next patch release. Bug
|
23
|
+
fixes and documentation improvements belong here, but not new features.
|
24
|
+
|
25
|
+
* The `next` branch is where we work on the next minor release. It's where most
|
26
|
+
new features go, as long as they're not breaking changes. Very occasionally
|
27
|
+
breaking changes will go here as well—see
|
28
|
+
[exceptional breakages](#exceptional-breakages) below for details.
|
29
|
+
|
30
|
+
* The `master` branch is where we work on the next major release. It's where
|
31
|
+
breaking changes go. We also occasionally decide that a non-breaking feature
|
32
|
+
is big enough to warrant saving until the next major release, in which case it
|
33
|
+
will also be developed here.
|
34
|
+
|
35
|
+
Ideally, pull requests would be made against the appropriate
|
36
|
+
branch, but don't worry about it too much; if you make a request against the
|
37
|
+
wrong branch, the maintainer will take responsibility for rebasing it before
|
38
|
+
merging.
|
39
|
+
|
40
|
+
### Testing
|
41
|
+
|
42
|
+
Tests for changes to the Sass language go in
|
43
|
+
[sass-spec](https://github.com/sass/sass-spec) so that other
|
44
|
+
implementations (E.g. libSass) can be tested against the same test
|
45
|
+
suite. The sass-spec repo follows a "trunk development" model in that
|
46
|
+
the tests there test against different version of the Sass language (as
|
47
|
+
opposed to having branches that track different Sass versions). When
|
48
|
+
contributing changes to Sass, update the Gemfile to use sass-spec from a
|
49
|
+
branch or fork that has the new tests. When the feature lands in Sass,
|
50
|
+
the committer will also merge the corresponding sass-spec changes.
|
51
|
+
|
52
|
+
The [documentation of
|
53
|
+
sass-spec](https://github.com/sass/sass-spec/blob/master/README.md)
|
54
|
+
explains how to run sass-spec and contribute changes. In development,
|
55
|
+
Change the Gemfile(s) to use the `:path` option against the sass-spec gem
|
56
|
+
to link your local checkout of sass and sass-spec together in one or
|
57
|
+
both directions.
|
58
|
+
|
59
|
+
Changes to Sass internals or Ruby Sass specific features (E.g.
|
60
|
+
the `sass-convert` tool) should always have tests in the Sass `test`
|
61
|
+
directory following the conventions you see there.
|
62
|
+
|
63
|
+
### Feature Branches
|
64
|
+
|
65
|
+
Sometimes it won't be possible to merge a new feature into `next` or `master`
|
66
|
+
immediately. It may require longer-term work before it's complete, or we may not
|
67
|
+
want to release it as part of any alpha releases of the branch in question.
|
68
|
+
Branches like this are labeled `feature.#{name}` and stay on GitHub until
|
69
|
+
they're ready to be merged.
|
70
|
+
|
71
|
+
### Experimental Branches
|
72
|
+
|
73
|
+
Not all features pan out, and not all code is a good fit for merging into the
|
74
|
+
main codebase. Usually when this happens the code is just discarded, but every
|
75
|
+
so often it's interesting or promising enough that it's worth keeping around.
|
76
|
+
This is what experimental branches (labeled `experimental.#{name}`) are for.
|
77
|
+
While they're not currently in use, they contain code that might be useful in
|
78
|
+
the future.
|
79
|
+
|
80
|
+
### Old Stable Branches
|
81
|
+
|
82
|
+
Usually Sass doesn't have the development time to do long-term maintenance of
|
83
|
+
old release. But occasionally, very rarely, it becomes necessary. In cases like
|
84
|
+
that, a branch named `stable_#{version}` will be created, starting from the last
|
85
|
+
tag in that version series.
|
86
|
+
|
87
|
+
## Versioning
|
88
|
+
|
89
|
+
Starting with version 3.5.0, Sass uses [semantic versioning](http://semver.org/)
|
90
|
+
to indicate the evolution of its language semantics as much as possible. This
|
91
|
+
means that patch releases (such as 3.5.3) contain only bug fixes, minor releases
|
92
|
+
(such as 3.6.0) contain backwards-compatible features, and only major releases
|
93
|
+
(such as 4.0.0) are allowed to have backwards-incompatible behavior. There are
|
94
|
+
[exceptions](#exceptional-breakages), but we try to follow this rule as closely
|
95
|
+
as possible.
|
96
|
+
|
97
|
+
Note, however, that the semantic versioning applies only to the language's
|
98
|
+
semantics, not to the Ruby APIs. Although we try hard to keep widely-used APIs
|
99
|
+
like [`Sass::Engine`][Sass::Engine] stable, we don't have a strong distinction
|
100
|
+
between public and private APIs and we need to be able to freely refactor our
|
101
|
+
code.
|
102
|
+
|
103
|
+
[Sass::Engine]: http://sass-lang.com/documentation/Sass/Engine.html
|
104
|
+
|
105
|
+
### Making Breaking Changes
|
106
|
+
|
107
|
+
Sometimes the old way of doing something just isn't going to work anymore, and
|
108
|
+
the new way just can't be made backwards-compatible. In that case, a breaking
|
109
|
+
change is necessary. These changes are rarely pleasant, but they contribute to
|
110
|
+
making the language better in the long term.
|
111
|
+
|
112
|
+
Our breaking change process tries to make such changes as clear to users and as
|
113
|
+
easy to adapt to as possible. We want to ensure that there's a clear path
|
114
|
+
forward for users using functionality that will no longer exist, and that they
|
115
|
+
are able to understand what's changing and what they need to do. We've developed
|
116
|
+
the following process for this:
|
117
|
+
|
118
|
+
1. Deprecate the old behavior [in `stable`](#branches). At minimum, deprecating
|
119
|
+
some behavior involves printing a warning when that behavior is used
|
120
|
+
explaining that it's going to go away in the future. Ideally, this message
|
121
|
+
will also include code that will do the same thing in a non-deprecated way.
|
122
|
+
If there's a thorough prose explanation of the change available online, the
|
123
|
+
message should link to that as well.
|
124
|
+
|
125
|
+
2. If possible, make `sass-convert` (also in `stable`) convert the deprecated
|
126
|
+
behavior into a non-deprecated form. This allows users to run `sass-convert
|
127
|
+
-R -i` to automatically update their stylesheets.
|
128
|
+
|
129
|
+
3. Implement the new behavior in `master`. The sooner this happens, the better:
|
130
|
+
it may be unclear exactly what needs to be deprecated until the new
|
131
|
+
implementation exists.
|
132
|
+
|
133
|
+
4. Release an alpha version of `master` that includes the new behavior. This
|
134
|
+
allows users who are dissatisfied with the workaround to use the new
|
135
|
+
behavior early. Normally a maintainer will take care of this.
|
136
|
+
|
137
|
+
### Exceptional Breakages
|
138
|
+
|
139
|
+
Because Sass's syntax and semantics are closely tied to those of CSS, there are
|
140
|
+
occasionally times when CSS syntax is introduced that overlaps with
|
141
|
+
previously-valid Sass. In this case in particular, we may introduce a breaking
|
142
|
+
change in a minor version to get back to CSS compatibility as soon as possible.
|
143
|
+
|
144
|
+
Exceptional breakages still require the full deprecation process; the only
|
145
|
+
change is that the new behavior is implemented in `next` rather than `master`.
|
146
|
+
Because there are no minor releases between the deprecation and the removal of
|
147
|
+
the old behavior, the deprecation warning should be introduced soon as it
|
148
|
+
becomes clear that an exceptional breakage is necessary.
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2006-
|
1
|
+
Copyright (c) 2006-2016 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
# Sass [](http://badge.fury.io/rb/sass) [](http://inch-ci.org/github/sass/sass)
|
2
2
|
|
3
|
-
**Sass makes CSS fun again**. Sass is an extension of
|
3
|
+
**Sass makes CSS fun again**. Sass is an extension of CSS,
|
4
4
|
adding nested rules, variables, mixins, selector inheritance, and more.
|
5
5
|
It's translated to well-formatted, standard CSS
|
6
6
|
using the command line tool or a web-framework plugin.
|
7
7
|
|
8
8
|
Sass has two syntaxes. The new main syntax (as of Sass 3)
|
9
9
|
is known as "SCSS" (for "Sassy CSS"),
|
10
|
-
and is a superset of
|
11
|
-
This means that every valid
|
10
|
+
and is a superset of CSS's syntax.
|
11
|
+
This means that every valid CSS stylesheet is valid SCSS as well.
|
12
12
|
SCSS files use the extension `.scss`.
|
13
13
|
|
14
14
|
The second, older syntax is known as the indented syntax (or just "Sass").
|
@@ -184,7 +184,7 @@ See `sass-convert --help` for further information and options.
|
|
184
184
|
To run the Sass executables from a source checkout instead of from rubygems:
|
185
185
|
|
186
186
|
```
|
187
|
-
$ cd
|
187
|
+
$ cd sass
|
188
188
|
$ bundle
|
189
189
|
$ bundle exec sass ...
|
190
190
|
$ bundle exec scss ...
|
@@ -199,23 +199,29 @@ and now occasionally consults on the language issues. Hampton lives in San
|
|
199
199
|
Francisco, California and works as VP of Technology
|
200
200
|
at [Moovweb](http://www.moovweb.com/).
|
201
201
|
|
202
|
-
[Natalie Weizenbaum](
|
203
|
-
Sass. Her hard work has kept the project alive by endlessly
|
204
|
-
posts, fixing bugs, refactoring, finding speed improvements,
|
205
|
-
documentation, implementing new features, and
|
206
|
-
|
207
|
-
|
202
|
+
[Natalie Weizenbaum](https://twitter.com/nex3) is the primary developer and
|
203
|
+
architect of Sass. Her hard work has kept the project alive by endlessly
|
204
|
+
answering forum posts, fixing bugs, refactoring, finding speed improvements,
|
205
|
+
writing documentation, implementing new features, and designing the language.
|
206
|
+
Natalie lives in Seattle, Washington and works on [Dart](http://dartlang.org)
|
207
|
+
application libraries at Google.
|
208
208
|
|
209
|
-
[Chris Eppstein](http://
|
210
|
-
Sass and the creator of Compass, the first Sass-based framework
|
209
|
+
[Chris Eppstein](http://twitter.com/chriseppstein) is a core contributor to
|
210
|
+
Sass and the creator of [Compass](http://compass-style.org/), the first Sass-based framework, and
|
211
|
+
[Eyeglass](http://github.com/sass-eyeglass/eyeglass), a node-sass plugin ecosystem for NPM. Chris focuses
|
211
212
|
on making Sass more powerful, easy to use, and on ways to speed its adoption
|
212
213
|
through the web development community. Chris lives in San Jose, California with
|
213
|
-
his wife and
|
214
|
-
[LinkedIn.com](http://linkedin.com), where
|
215
|
-
maintain Sass
|
214
|
+
his wife and two children. He is an Engineer for
|
215
|
+
[LinkedIn.com](http://linkedin.com), where his primary responsibility is to
|
216
|
+
maintain Sass and many other Sass-related open source projects.
|
216
217
|
|
217
|
-
If you use this software,
|
218
|
-
|
218
|
+
If you use this software, we'd be truly honored if you'd make a
|
219
|
+
tax-deductible donation to a non-profit organization and then
|
220
|
+
[let us know on twitter](http://twitter.com/SassCSS), so that we can
|
221
|
+
thank you. Here's a few that we endorse:
|
219
222
|
|
220
|
-
|
221
|
-
|
223
|
+
* [Trans Justice Funding Project](http://www.transjusticefundingproject.org/)
|
224
|
+
* [United Mitochondrial Disease Foundation](http://umdf.org/compass)
|
225
|
+
* [Girl Develop It](https://www.girldevelopit.com/donate)
|
226
|
+
|
227
|
+
Sass is licensed under the MIT License.
|
data/Rakefile
CHANGED
@@ -12,34 +12,118 @@ task :default => :test
|
|
12
12
|
|
13
13
|
require 'rake/testtask'
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
LINE_SIZE = 80
|
16
|
+
DECORATION_CHAR = '#'
|
17
|
+
|
18
|
+
def print_header(string)
|
19
|
+
length = string.length
|
20
|
+
puts DECORATION_CHAR * LINE_SIZE
|
21
|
+
puts string.center(length + 2, ' ').center(LINE_SIZE, DECORATION_CHAR)
|
22
|
+
puts DECORATION_CHAR * LINE_SIZE
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Run all tests"
|
26
|
+
task :test do
|
27
|
+
test_cases = [
|
28
|
+
{
|
29
|
+
'env' => {'MATHN' => 'true'},
|
30
|
+
'tasks' => ['test:ruby', 'test:spec', :rubocop]
|
31
|
+
},
|
32
|
+
{
|
33
|
+
'env' => {'MATHN' => 'false'},
|
34
|
+
'tasks' => ['test:ruby']
|
35
|
+
}
|
36
|
+
]
|
37
|
+
|
38
|
+
test_cases.each do |test_case|
|
39
|
+
env = test_case['env']
|
40
|
+
tasks = test_case['tasks']
|
41
|
+
|
42
|
+
env.each do |key, value|
|
43
|
+
ENV[key] = value
|
44
|
+
end
|
45
|
+
tasks.each do |task|
|
46
|
+
print_header("Running task: #{task}, env: #{env}")
|
47
|
+
Rake::Task[task].execute
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
namespace :test do
|
53
|
+
desc "Run the ruby tests (without sass-spec)"
|
54
|
+
Rake::TestTask.new("ruby") do |t|
|
55
|
+
t.libs << 'test'
|
56
|
+
test_files = FileList[scope('test/**/*_test.rb')]
|
57
|
+
test_files.exclude(scope('test/rails/*'))
|
58
|
+
test_files.exclude(scope('test/plugins/*'))
|
59
|
+
t.test_files = test_files
|
60
|
+
t.warning = true
|
61
|
+
t.verbose = true
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "Run sass-spec tests against the local code."
|
65
|
+
task :spec do
|
66
|
+
require "yaml"
|
67
|
+
sass_spec_options = YAML.load_file(scope("test/sass-spec.yml"))
|
68
|
+
enabled = sass_spec_options.delete(:enabled)
|
69
|
+
unless enabled
|
70
|
+
puts "SassSpec tests are disabled."
|
71
|
+
next
|
72
|
+
end
|
73
|
+
if ruby_version_at_least?("1.9.2")
|
74
|
+
old_load_path = $:.dup
|
75
|
+
begin
|
76
|
+
$:.unshift(File.join(File.dirname(__FILE__), "lib"))
|
77
|
+
begin
|
78
|
+
require 'sass_spec'
|
79
|
+
rescue LoadError
|
80
|
+
puts "You probably forgot to run: bundle exec rake"
|
81
|
+
raise
|
82
|
+
end
|
83
|
+
default_options = {
|
84
|
+
:spec_directory => SassSpec::SPEC_DIR,
|
85
|
+
:engine_adapter => SassEngineAdapter.new,
|
86
|
+
:generate => false,
|
87
|
+
:tap => false,
|
88
|
+
:skip => false,
|
89
|
+
:verbose => false,
|
90
|
+
:filter => "",
|
91
|
+
:limit => -1,
|
92
|
+
:unexpected_pass => false,
|
93
|
+
:nuke => false,
|
94
|
+
}
|
95
|
+
SassSpec::Runner.new(default_options.merge(sass_spec_options)).run || exit(1)
|
96
|
+
ensure
|
97
|
+
$:.replace(old_load_path)
|
98
|
+
end
|
99
|
+
else
|
100
|
+
"Skipping sass-spec on ruby versions less than 1.9.2"
|
101
|
+
end
|
102
|
+
end
|
22
103
|
end
|
23
104
|
|
24
105
|
# ----- Code Style Enforcement -----
|
25
106
|
|
26
|
-
|
107
|
+
def ruby_version_at_least?(version_string)
|
108
|
+
ruby_version = Gem::Version.new(RUBY_VERSION.dup)
|
109
|
+
version = Gem::Version.new(version_string)
|
110
|
+
ruby_version >= version
|
111
|
+
end
|
112
|
+
|
113
|
+
begin
|
27
114
|
require 'rubocop/rake_task'
|
28
|
-
Rubocop
|
115
|
+
RuboCop = Rubocop unless defined?(RuboCop)
|
116
|
+
RuboCop::RakeTask.new do |t|
|
29
117
|
t.patterns = FileList["lib/**/*"]
|
30
118
|
end
|
31
|
-
|
119
|
+
rescue LoadError
|
32
120
|
task :rubocop do
|
33
|
-
puts "
|
34
|
-
|
35
|
-
|
36
|
-
puts "Use ruby 1.9 or greater and then run the style check with: rake rubocop"
|
37
|
-
end
|
121
|
+
puts "Rubocop is disabled."
|
122
|
+
puts "Passing this check is required in order for your patch to be accepted."
|
123
|
+
puts "Install Rubocop and then run the style check with: rake rubocop."
|
38
124
|
end
|
39
125
|
end
|
40
126
|
|
41
|
-
task :test => :rubocop
|
42
|
-
|
43
127
|
# ----- Packaging -----
|
44
128
|
|
45
129
|
# Don't use Rake::GemPackageTast because we want prerequisites to run
|
@@ -98,13 +182,12 @@ end
|
|
98
182
|
|
99
183
|
desc "Install Sass as a gem. Use SUDO=1 to install with sudo."
|
100
184
|
task :install => [:package] do
|
101
|
-
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
|
185
|
+
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
|
102
186
|
sh %{#{'sudo ' if ENV["SUDO"]}#{gem} install --no-ri pkg/sass-#{get_version}}
|
103
187
|
end
|
104
188
|
|
105
189
|
desc "Release a new Sass package to RubyGems.org."
|
106
190
|
task :release => [:check_release, :package] do
|
107
|
-
name = File.read(scope("VERSION_NAME")).strip
|
108
191
|
version = File.read(scope("VERSION")).strip
|
109
192
|
sh %{gem push pkg/sass-#{version}.gem}
|
110
193
|
end
|
@@ -310,7 +393,7 @@ END
|
|
310
393
|
file = File.read(scope("test/sass/templates/#{file || 'complex'}.sass"))
|
311
394
|
result = RubyProf.profile { times.times { Sass::Engine.new(file).render } }
|
312
395
|
|
313
|
-
RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
|
396
|
+
RubyProf.const_get("#{(ENV['OUTPUT'] || 'Flat').capitalize}Printer").new(result).print
|
314
397
|
end
|
315
398
|
rescue LoadError; end
|
316
399
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.25
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
07 July 2017 22:00:34 UTC
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/bin/bash -e
|
2
|
+
# Copyright 2016 Google Inc. Use of this source code is governed by an MIT-style
|
3
|
+
# license that can be found in the LICENSE file or at
|
4
|
+
# https://opensource.org/licenses/MIT.
|
5
|
+
|
6
|
+
# Echoes the sass-spec Git ref that should be checked out for the current Travis
|
7
|
+
# run. If we're running specs for a pull request which refers to a sass-spec
|
8
|
+
# pull request, we'll run against the latter rather than sass-spec master.
|
9
|
+
|
10
|
+
default=master
|
11
|
+
|
12
|
+
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
13
|
+
>&2 echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST."
|
14
|
+
>&2 echo "Ref: $default."
|
15
|
+
echo "$default"
|
16
|
+
exit 0
|
17
|
+
fi
|
18
|
+
|
19
|
+
>&2 echo "Fetching pull request $TRAVIS_PULL_REQUEST..."
|
20
|
+
|
21
|
+
JSON=$(curl -L -sS https://api.github.com/repos/sass/sass/pulls/$TRAVIS_PULL_REQUEST)
|
22
|
+
|
23
|
+
RE_SPEC_PR="sass\/sass-spec(#|\/pull\/)([0-9]+)"
|
24
|
+
|
25
|
+
if [[ $JSON =~ $RE_SPEC_PR ]]; then
|
26
|
+
ref="pull/${BASH_REMATCH[2]}/head"
|
27
|
+
>&2 echo "Ref: $ref."
|
28
|
+
echo "$ref"
|
29
|
+
else
|
30
|
+
>&2 echo "Ref: $default."
|
31
|
+
echo "$default"
|
32
|
+
fi
|
data/extra/update_watch.rb
CHANGED
@@ -7,7 +7,7 @@ enable :lock
|
|
7
7
|
Dir.chdir(File.dirname(__FILE__) + "/..")
|
8
8
|
|
9
9
|
post "/" do
|
10
|
-
puts "
|
10
|
+
puts "Received payload!"
|
11
11
|
puts "Rev: #{`git name-rev HEAD`.strip}"
|
12
12
|
system %{rake handle_update --trace REF=#{JSON.parse(params["payload"])["ref"].inspect}}
|
13
13
|
end
|
@@ -17,12 +17,12 @@ module Sass
|
|
17
17
|
# @see Base#\_retrieve
|
18
18
|
def _retrieve(key, version, sha)
|
19
19
|
return unless File.readable?(path_to(key))
|
20
|
-
File.open(path_to(key), "rb") do |f|
|
21
|
-
if f.readline("\n").strip == version && f.readline("\n").strip == sha
|
22
|
-
return f.read
|
23
|
-
end
|
24
|
-
end
|
25
20
|
begin
|
21
|
+
File.open(path_to(key), "rb") do |f|
|
22
|
+
if f.readline("\n").strip == version && f.readline("\n").strip == sha
|
23
|
+
return f.read
|
24
|
+
end
|
25
|
+
end
|
26
26
|
File.unlink path_to(key)
|
27
27
|
rescue Errno::ENOENT
|
28
28
|
# Already deleted. Race condition?
|
@@ -36,7 +36,7 @@ module Sass
|
|
36
36
|
def _store(key, version, sha, contents)
|
37
37
|
compiled_filename = path_to(key)
|
38
38
|
FileUtils.mkdir_p(File.dirname(compiled_filename))
|
39
|
-
Sass::Util.atomic_create_and_write_file(compiled_filename
|
39
|
+
Sass::Util.atomic_create_and_write_file(compiled_filename) do |f|
|
40
40
|
f.puts(version)
|
41
41
|
f.puts(sha)
|
42
42
|
f.write(contents)
|
@@ -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" % Sass::Util.ord(c)}
|
55
|
+
key = key.gsub(/[<>:\\|?*%]/) {|c| "%%%03d" % (Sass::Util.ord(c))}
|
56
56
|
File.join(cache_location, key)
|
57
57
|
end
|
58
58
|
end
|
@@ -26,11 +26,10 @@ module Sass
|
|
26
26
|
|
27
27
|
# @see Base#retrieve
|
28
28
|
def retrieve(key, sha)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
29
|
+
return unless @contents.has_key?(key)
|
30
|
+
return unless @contents[key][:sha] == sha
|
31
|
+
obj = @contents[key][:obj]
|
32
|
+
obj.respond_to?(:deep_copy) ? obj.deep_copy : obj.dup
|
34
33
|
end
|
35
34
|
|
36
35
|
# @see Base#store
|
data/lib/sass/callbacks.rb
CHANGED
@@ -51,12 +51,12 @@ module Sass
|
|
51
51
|
def define_callback(name)
|
52
52
|
class_eval <<RUBY, __FILE__, __LINE__ + 1
|
53
53
|
def on_#{name}(&block)
|
54
|
-
@_sass_callbacks
|
54
|
+
@_sass_callbacks = {} unless defined? @_sass_callbacks
|
55
55
|
(@_sass_callbacks[#{name.inspect}] ||= []) << block
|
56
56
|
end
|
57
57
|
|
58
58
|
def run_#{name}(*args)
|
59
|
-
return unless @_sass_callbacks
|
59
|
+
return unless defined? @_sass_callbacks
|
60
60
|
return unless @_sass_callbacks[#{name.inspect}]
|
61
61
|
@_sass_callbacks[#{name.inspect}].each {|c| c[*args]}
|
62
62
|
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`).
|
@@ -31,10 +31,11 @@ module Sass
|
|
31
31
|
template = template.read
|
32
32
|
end
|
33
33
|
|
34
|
-
@options = options.
|
34
|
+
@options = options.merge(:_convert => true)
|
35
35
|
# Backwards compatibility
|
36
36
|
@options[:old] = true if @options[:alternate] == false
|
37
37
|
@template = template
|
38
|
+
@checked_encoding = false
|
38
39
|
end
|
39
40
|
|
40
41
|
# Converts the CSS template into Sass or SCSS code.
|
@@ -75,14 +76,14 @@ module Sass
|
|
75
76
|
# @return [Tree::Node] The root node of the parsed tree
|
76
77
|
def build_tree
|
77
78
|
root = Sass::SCSS::CssParser.new(@template, @options[:filename], nil).parse
|
78
|
-
parse_selectors
|
79
|
-
expand_commas
|
80
|
-
nest_seqs
|
81
|
-
parent_ref_rules
|
82
|
-
flatten_rules
|
83
|
-
bubble_subject
|
84
|
-
fold_commas
|
85
|
-
dump_selectors
|
79
|
+
parse_selectors(root)
|
80
|
+
expand_commas(root)
|
81
|
+
nest_seqs(root)
|
82
|
+
parent_ref_rules(root)
|
83
|
+
flatten_rules(root)
|
84
|
+
bubble_subject(root)
|
85
|
+
fold_commas(root)
|
86
|
+
dump_selectors(root)
|
86
87
|
root
|
87
88
|
end
|
88
89
|
|
@@ -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
|