sass 3.4.12 → 3.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass/scss/css_parser.rb +15 -0
- data/lib/sass/selector/sequence.rb +22 -4
- data/lib/sass/selector/simple.rb +3 -6
- data/lib/sass/tree/visitors/convert.rb +4 -0
- data/test/sass/css2sass_test.rb +32 -0
- data/test/sass/extend_test.rb +20 -0
- data/test/sass/scss/css_test.rb +1 -1
- data/test/sass/scss/scss_test.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d20c295937040233d2c011ca20001285180ba16
|
4
|
+
data.tar.gz: 6335a222a12384382336d048635bcd0e0b3b473f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36072d55532236efa0e689550fddd097ae58e3bfa1e889e609d91fabf31f05b12c02cf04fa2803c0dce1b42ae0f460e110efb55b3614f1205da0daf848b7fee7
|
7
|
+
data.tar.gz: 7fd86b668d23751664fb507def2a7dec79ccbb311b756abcded9963a3a5422d4177798e3af9a0db17c8ec5858943bef8302ae6f92cdbe0f12d57b9013431692c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.13
|
data/VERSION_DATE
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
27 February 2015 02:28:58 UTC
|
data/lib/sass/scss/css_parser.rb
CHANGED
@@ -14,6 +14,13 @@ module Sass
|
|
14
14
|
def interpolation(warn_for_color = false); nil; end
|
15
15
|
def use_css_import?; true; end
|
16
16
|
|
17
|
+
def block_contents(node, context)
|
18
|
+
if node.is_a?(Sass::Tree::DirectiveNode) && node.normalized_name == '@keyframes'
|
19
|
+
context = :keyframes
|
20
|
+
end
|
21
|
+
super(node, context)
|
22
|
+
end
|
23
|
+
|
17
24
|
def block_child(context)
|
18
25
|
case context
|
19
26
|
when :ruleset
|
@@ -22,6 +29,8 @@ module Sass
|
|
22
29
|
directive || ruleset
|
23
30
|
when :directive
|
24
31
|
directive || declaration_or_ruleset
|
32
|
+
when :keyframes
|
33
|
+
keyframes_ruleset
|
25
34
|
end
|
26
35
|
end
|
27
36
|
|
@@ -35,6 +44,12 @@ module Sass
|
|
35
44
|
block(node(Sass::Tree::RuleNode.new(selector, range(start_pos)), start_pos), :ruleset)
|
36
45
|
end
|
37
46
|
|
47
|
+
def keyframes_ruleset
|
48
|
+
start_pos = source_position
|
49
|
+
return unless (selector = keyframes_selector)
|
50
|
+
block(node(Sass::Tree::KeyframeRuleNode.new(selector.strip), start_pos), :ruleset)
|
51
|
+
end
|
52
|
+
|
38
53
|
@sass_script_parser = Class.new(Sass::Script::CssParser)
|
39
54
|
@sass_script_parser.send(:include, ScriptParser)
|
40
55
|
end
|
@@ -260,10 +260,22 @@ module Sass
|
|
260
260
|
return [seq1] if seq2.empty?
|
261
261
|
|
262
262
|
seq1, seq2 = seq1.dup, seq2.dup
|
263
|
-
init = merge_initial_ops(seq1, seq2)
|
264
|
-
return unless
|
265
|
-
|
266
|
-
|
263
|
+
return unless (init = merge_initial_ops(seq1, seq2))
|
264
|
+
return unless (fin = merge_final_ops(seq1, seq2))
|
265
|
+
|
266
|
+
# Make sure there's only one root selector in the output.
|
267
|
+
root1 = has_root?(seq1.first) && seq1.shift
|
268
|
+
root2 = has_root?(seq2.first) && seq2.shift
|
269
|
+
if root1 && root2
|
270
|
+
return unless (root = root1.unify(root2))
|
271
|
+
seq1.unshift root
|
272
|
+
seq2.unshift root
|
273
|
+
elsif root1
|
274
|
+
seq2.unshift root1
|
275
|
+
elsif root2
|
276
|
+
seq1.unshift root2
|
277
|
+
end
|
278
|
+
|
267
279
|
seq1 = group_selectors(seq1)
|
268
280
|
seq2 = group_selectors(seq2)
|
269
281
|
lcs = Sass::Util.lcs(seq2, seq1) do |s1, s2|
|
@@ -274,6 +286,7 @@ module Sass
|
|
274
286
|
end
|
275
287
|
|
276
288
|
diff = [[init]]
|
289
|
+
|
277
290
|
until lcs.empty?
|
278
291
|
diff << chunks(seq1, seq2) {|s| parent_superselector?(s.first, lcs.first)} << [lcs.shift]
|
279
292
|
seq1.shift
|
@@ -613,6 +626,11 @@ module Sass
|
|
613
626
|
"(#{choices.join ', '})"
|
614
627
|
end.join ' '
|
615
628
|
end
|
629
|
+
|
630
|
+
def has_root?(sseq)
|
631
|
+
sseq.is_a?(SimpleSequence) &&
|
632
|
+
sseq.members.any? {|sel| sel.is_a?(Pseudo) && sel.normalized_name == "root"}
|
633
|
+
end
|
616
634
|
end
|
617
635
|
end
|
618
636
|
end
|
data/lib/sass/selector/simple.rb
CHANGED
@@ -72,12 +72,9 @@ module Sass
|
|
72
72
|
def unify(sels)
|
73
73
|
return sels if sels.any? {|sel2| eql?(sel2)}
|
74
74
|
sels_with_ix = Sass::Util.enum_with_index(sels)
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
else
|
79
|
-
sels_with_ix.find {|sel, _| sel.is_a?(Pseudo)}
|
80
|
-
end
|
75
|
+
if !is_a?(Pseudo) || (sels.last.is_a?(Pseudo) && sels.last.type == :element)
|
76
|
+
_, i = sels_with_ix.find {|sel, _| sel.is_a?(Pseudo)}
|
77
|
+
end
|
81
78
|
return sels + [self] unless i
|
82
79
|
sels[0...i] + [self] + sels[i..-1]
|
83
80
|
end
|
data/test/sass/css2sass_test.rb
CHANGED
@@ -263,6 +263,38 @@ SASS
|
|
263
263
|
CSS
|
264
264
|
end
|
265
265
|
|
266
|
+
def test_keyframes
|
267
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
268
|
+
@keyframes dash
|
269
|
+
from
|
270
|
+
stroke-dasharray: 1,200
|
271
|
+
stroke-dashoffset: 0
|
272
|
+
|
273
|
+
50%
|
274
|
+
stroke-dasharray: 89,200
|
275
|
+
stroke-dashoffset: -35
|
276
|
+
|
277
|
+
to
|
278
|
+
stroke-dasharray: 89,200
|
279
|
+
stroke-dashoffset: -124
|
280
|
+
SASS
|
281
|
+
@keyframes dash {
|
282
|
+
from {
|
283
|
+
stroke-dasharray: 1,200;
|
284
|
+
stroke-dashoffset: 0;
|
285
|
+
}
|
286
|
+
50% {
|
287
|
+
stroke-dasharray: 89,200;
|
288
|
+
stroke-dashoffset: -35;
|
289
|
+
}
|
290
|
+
to {
|
291
|
+
stroke-dasharray: 89,200;
|
292
|
+
stroke-dashoffset: -124;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
CSS
|
296
|
+
end
|
297
|
+
|
266
298
|
# Regressions
|
267
299
|
|
268
300
|
def test_nesting_with_matching_property
|
data/test/sass/extend_test.rb
CHANGED
@@ -503,6 +503,16 @@ CSS
|
|
503
503
|
SCSS
|
504
504
|
end
|
505
505
|
|
506
|
+
def test_root_only_allowed_at_root
|
507
|
+
assert_extends(':root .foo', '.bar .baz {@extend .foo}',
|
508
|
+
':root .foo, :root .bar .baz')
|
509
|
+
assert_extends('.foo:root .bar', '.baz:root .bang {@extend .bar}',
|
510
|
+
'.foo:root .bar, .baz.foo:root .bang')
|
511
|
+
assert_extends('html:root .bar', 'xml:root .bang {@extend .bar}', 'html:root .bar')
|
512
|
+
assert_extends('.foo:root > .bar .x', '.baz:root .bang .y {@extend .x}',
|
513
|
+
'.foo:root > .bar .x, .baz.foo:root > .bar .bang .y')
|
514
|
+
end
|
515
|
+
|
506
516
|
def test_comma_extendee
|
507
517
|
assert_equal <<CSS, render(<<SCSS)
|
508
518
|
.foo, .baz {
|
@@ -1338,6 +1348,16 @@ SCSS
|
|
1338
1348
|
|
1339
1349
|
# Regression Tests
|
1340
1350
|
|
1351
|
+
def test_extend_with_middle_pseudo
|
1352
|
+
assert_equal(<<CSS, render(<<SCSS))
|
1353
|
+
.btn:active.focus, :active.focus:before {
|
1354
|
+
a: b; }
|
1355
|
+
CSS
|
1356
|
+
.btn:active.focus {a: b}
|
1357
|
+
:before {@extend .btn}
|
1358
|
+
SCSS
|
1359
|
+
end
|
1360
|
+
|
1341
1361
|
def test_extend_parent_selector_suffix
|
1342
1362
|
assert_equal <<CSS, render(<<SCSS)
|
1343
1363
|
.a-b, .c {
|
data/test/sass/scss/css_test.rb
CHANGED
data/test/sass/scss/scss_test.rb
CHANGED
@@ -3925,6 +3925,22 @@ CSS
|
|
3925
3925
|
SCSS
|
3926
3926
|
end
|
3927
3927
|
|
3928
|
+
def test_keyword_arg_scope
|
3929
|
+
assert_equal <<CSS, render(<<SCSS)
|
3930
|
+
.mixed {
|
3931
|
+
arg1: default;
|
3932
|
+
arg2: non-default; }
|
3933
|
+
CSS
|
3934
|
+
$arg1: default;
|
3935
|
+
$arg2: default;
|
3936
|
+
@mixin a-mixin($arg1: $arg1, $arg2: $arg2) {
|
3937
|
+
arg1: $arg1;
|
3938
|
+
arg2: $arg2;
|
3939
|
+
}
|
3940
|
+
.mixed { @include a-mixin($arg2: non-default); }
|
3941
|
+
SCSS
|
3942
|
+
end
|
3943
|
+
|
3928
3944
|
def test_passing_required_args_as_a_keyword_arg
|
3929
3945
|
assert_equal <<CSS, render(<<SCSS)
|
3930
3946
|
.mixed {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natalie Weizenbaum
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-02-
|
13
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: yard
|