sass 3.1.0.alpha.42 → 3.1.0.alpha.43
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/script/functions.rb +23 -0
- data/test/sass/functions_test.rb +5 -0
- metadata +13 -13
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.43
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.43
|
@@ -138,6 +138,11 @@ module Sass::Script
|
|
138
138
|
# \{#comparable comparable($number-1, $number-2)}
|
139
139
|
# : Returns whether two numbers can be added or compared.
|
140
140
|
#
|
141
|
+
# ## Miscellaneous Functions
|
142
|
+
#
|
143
|
+
# \{#if if($condition, $if-true, $if-false)}
|
144
|
+
# : Returns one of two values, depending on whether or not a condition is true.
|
145
|
+
#
|
141
146
|
# ## Adding Custom Functions
|
142
147
|
#
|
143
148
|
# New Sass functions can be added by adding Ruby methods to this module.
|
@@ -1078,6 +1083,24 @@ module Sass::Script
|
|
1078
1083
|
declare :append, [:list, :val]
|
1079
1084
|
declare :append, [:list, :val, :separator]
|
1080
1085
|
|
1086
|
+
# Returns one of two values based on the truth value of the first argument.
|
1087
|
+
#
|
1088
|
+
# @example
|
1089
|
+
# if(true, 1px, 2px) => 1px
|
1090
|
+
# if(false, 1px, 2px) => 2px
|
1091
|
+
# @param condition [Bool] Whether the first or second value will be returned.
|
1092
|
+
# @param if_true [Literal] The value that will be returned if `$condition` is true.
|
1093
|
+
# @param if_false [Literal] The value that will be returned if `$condition` is false.
|
1094
|
+
def if(condition, if_true, if_false)
|
1095
|
+
assert_type condition, :Bool
|
1096
|
+
if truth.to_bool
|
1097
|
+
if_true
|
1098
|
+
else
|
1099
|
+
if_false
|
1100
|
+
end
|
1101
|
+
end
|
1102
|
+
declare :if, [:condition, :if_true, :if_false]
|
1103
|
+
|
1081
1104
|
private
|
1082
1105
|
|
1083
1106
|
# This method implements the pattern of transforming a numeric value into
|
data/test/sass/functions_test.rb
CHANGED
@@ -668,6 +668,11 @@ MSG
|
|
668
668
|
assert_error_message("Separator name must be space, comma, or auto for `append'", "append(1, 2, baboon)")
|
669
669
|
end
|
670
670
|
|
671
|
+
def test_if
|
672
|
+
assert_equal("1px", evaluate("if(true, 1px, 2px)"))
|
673
|
+
assert_equal("2px", evaluate("if(false, 1px, 2px)"))
|
674
|
+
end
|
675
|
+
|
671
676
|
def test_keyword_args_rgb
|
672
677
|
assert_equal(%Q{white}, evaluate("rgb($red: 255, $green: 255, $blue: 255)"))
|
673
678
|
end
|
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.1.0.alpha.
|
4
|
+
version: 3.1.0.alpha.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Weizenbaum
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/sass/plugin.rb
|
58
58
|
- lib/sass/script.rb
|
59
59
|
- lib/sass/selector.rb
|
60
|
+
- lib/sass/cache_stores.rb
|
60
61
|
- lib/sass/plugin/configuration.rb
|
61
62
|
- lib/sass/plugin/merb.rb
|
62
63
|
- lib/sass/plugin/generic.rb
|
@@ -64,11 +65,13 @@ files:
|
|
64
65
|
- lib/sass/plugin/rails.rb
|
65
66
|
- lib/sass/plugin/staleness_checker.rb
|
66
67
|
- lib/sass/plugin/compiler.rb
|
67
|
-
- lib/sass/
|
68
|
+
- lib/sass/cache_stores/active_support.rb
|
69
|
+
- lib/sass/cache_stores/base.rb
|
70
|
+
- lib/sass/cache_stores/filesystem.rb
|
71
|
+
- lib/sass/cache_stores/memory.rb
|
72
|
+
- lib/sass/cache_stores/null.rb
|
68
73
|
- lib/sass/repl.rb
|
69
|
-
- lib/sass/importers
|
70
|
-
- lib/sass/importers/filesystem.rb
|
71
|
-
- lib/sass/importers/rails.rb
|
74
|
+
- lib/sass/importers.rb
|
72
75
|
- lib/sass/root.rb
|
73
76
|
- lib/sass/script/bool.rb
|
74
77
|
- lib/sass/script/color.rb
|
@@ -96,13 +99,15 @@ files:
|
|
96
99
|
- lib/sass/scss/script_lexer.rb
|
97
100
|
- lib/sass/scss/script_parser.rb
|
98
101
|
- lib/sass/scss/static_parser.rb
|
99
|
-
- lib/sass/
|
102
|
+
- lib/sass/importers/base.rb
|
103
|
+
- lib/sass/importers/filesystem.rb
|
104
|
+
- lib/sass/importers/rails.rb
|
100
105
|
- lib/sass/selector/abstract_sequence.rb
|
101
106
|
- lib/sass/selector/comma_sequence.rb
|
102
107
|
- lib/sass/selector/sequence.rb
|
103
108
|
- lib/sass/selector/simple.rb
|
104
109
|
- lib/sass/selector/simple_sequence.rb
|
105
|
-
- lib/sass/
|
110
|
+
- lib/sass/railtie.rb
|
106
111
|
- lib/sass/tree/charset_node.rb
|
107
112
|
- lib/sass/tree/comment_node.rb
|
108
113
|
- lib/sass/tree/debug_node.rb
|
@@ -122,15 +127,10 @@ files:
|
|
122
127
|
- lib/sass/tree/variable_node.rb
|
123
128
|
- lib/sass/tree/while_node.rb
|
124
129
|
- lib/sass/tree/media_node.rb
|
130
|
+
- lib/sass/shared.rb
|
125
131
|
- lib/sass/util.rb
|
126
132
|
- lib/sass/util/subset_map.rb
|
127
133
|
- lib/sass/version.rb
|
128
|
-
- lib/sass/cache_stores.rb
|
129
|
-
- lib/sass/cache_stores/active_support.rb
|
130
|
-
- lib/sass/cache_stores/base.rb
|
131
|
-
- lib/sass/cache_stores/filesystem.rb
|
132
|
-
- lib/sass/cache_stores/memory.rb
|
133
|
-
- lib/sass/cache_stores/null.rb
|
134
134
|
- vendor/fssm/LICENSE
|
135
135
|
- vendor/fssm/README.markdown
|
136
136
|
- vendor/fssm/Rakefile
|