SassyExport 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/SassyExport.rb +23 -22
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3c3e18cfe073e85dddbfa3417f8a36612b4e5e0
|
4
|
+
data.tar.gz: feb2c593aed507edc440be127163718abd63344d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe01b1754d5043e6a4f95ef5a80278ea4e2c8f2f667d4c60df64d11eeca45fd27741c6b0b86e732b65dba6a5bc2f6b99a974030b8c07f41b0096206a2372d100
|
7
|
+
data.tar.gz: 6978dee499e0212e8b2ece33509271ceabd4ed316e4f11354b6f0ac4a5ab1e5cc6cbc57f88f8344996b00776b9be952d4a9c9ff7bfcbb062b1a0bf00a74d8f00
|
data/lib/SassyExport.rb
CHANGED
@@ -7,7 +7,7 @@ Compass::Frameworks.register('SassyExport', :path => extension_path)
|
|
7
7
|
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
8
8
|
# Date is in the form of YYYY-MM-DD
|
9
9
|
module SassyExport
|
10
|
-
VERSION = "1.3.
|
10
|
+
VERSION = "1.3.3"
|
11
11
|
DATE = "2014-07-24"
|
12
12
|
end
|
13
13
|
|
@@ -37,24 +37,21 @@ module Sass::Script::Functions
|
|
37
37
|
def recurs_to_a(array)
|
38
38
|
if array.is_a?(Array)
|
39
39
|
array.map do | l |
|
40
|
-
|
40
|
+
case l
|
41
|
+
when Sass::Script::Value::Map
|
41
42
|
# if map, recurse to hash
|
42
43
|
l = recurs_to_h(l)
|
43
|
-
|
44
|
+
when Sass::Script::Value::List
|
44
45
|
# if list, recurse to array
|
45
46
|
l = recurs_to_a(l)
|
46
|
-
|
47
|
+
when Sass::Script::Value::Bool
|
47
48
|
# convert to bool
|
48
49
|
l = l.to_bool
|
49
|
-
|
50
|
+
when Sass::Script::Value::Number
|
50
51
|
# if it's a unitless number, convert to ruby val
|
51
|
-
if l.unitless?
|
52
|
-
l = l.value
|
53
52
|
# else convert to string
|
54
|
-
|
55
|
-
|
56
|
-
end
|
57
|
-
elsif l.is_a?(Sass::Script::Value::Color)
|
53
|
+
l.unitless? ? l = l.value : l = u(l)
|
54
|
+
when Sass::Script::Value::Color
|
58
55
|
# get hex/rgba value for color
|
59
56
|
l = l.inspect
|
60
57
|
else
|
@@ -72,21 +69,25 @@ module Sass::Script::Functions
|
|
72
69
|
def recurs_to_h(hash)
|
73
70
|
if hash.is_a?(Hash)
|
74
71
|
hash.inject({}) do | h, (k, v) |
|
75
|
-
|
72
|
+
case v
|
73
|
+
when Sass::Script::Value::Map
|
74
|
+
# if map, recurse to hash
|
76
75
|
h[u(k)] = recurs_to_h(v)
|
77
|
-
|
76
|
+
when Sass::Script::Value::List
|
77
|
+
# if list, recurse to array
|
78
78
|
h[u(k)] = recurs_to_a(v)
|
79
|
-
|
79
|
+
when Sass::Script::Value::Bool
|
80
|
+
# convert to bool
|
80
81
|
h[u(k)] = v.to_bool
|
81
|
-
|
82
|
-
if
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
elsif v.is_a?(Sass::Script::Value::Color)
|
82
|
+
when Sass::Script::Value::Number
|
83
|
+
# if it's a unitless number, convert to ruby val
|
84
|
+
# else convert to string
|
85
|
+
v.unitless? ? h[u(k)] = v.value : h[u(k)] = u(v)
|
86
|
+
when Sass::Script::Value::Color
|
87
|
+
# get hex/rgba value for color
|
88
88
|
h[u(k)] = v.inspect
|
89
89
|
else
|
90
|
+
# convert to string
|
90
91
|
h[u(k)] = u(v)
|
91
92
|
end
|
92
93
|
h
|
@@ -143,7 +144,7 @@ module Sass::Script::Functions
|
|
143
144
|
pretty ? json = JSON.pretty_generate(hash) : json = JSON.generate(hash)
|
144
145
|
|
145
146
|
# if we're turning it straight to js put a variable name in front
|
146
|
-
|
147
|
+
json = "var " + filename + " = " + json if ext == '.js'
|
147
148
|
|
148
149
|
# define flags
|
149
150
|
flag = 'w'
|