SassyExport 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/SassyExport.rb +6 -3
- 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: 875b72084fad3d502ad40961e06d1f9988557ea0
|
4
|
+
data.tar.gz: ab9a9c200b55347db06b0178ab6fb93fe884b6f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e59df5bc10bee17f113dea3e6cb8a7ca98992be0cd5cd0cf883b82e41b57cb71cc570fa80a8f6121364dfba1ff905b9dd9ca2727ef575a3f6201b032c7a6766
|
7
|
+
data.tar.gz: 8b34a55e3a21ea95db205e992873f669175e9fab2696f27ea895c2e88a5ff4cf80422c192b684d6604f71d03b231cbcce1287cbd6b6c1fa916058ece94503ac1
|
data/README.md
CHANGED
@@ -54,7 +54,7 @@ New JSON file is created at `./json/hello.json`. As you can see, `$path` is rela
|
|
54
54
|
|
55
55
|
#### Breakdown
|
56
56
|
|
57
|
-
The `SassyExport()` mixin takes a
|
57
|
+
The `SassyExport()` mixin takes a \<directory\>/\<filename\>.\<ext\> `$path` and a Sass `$map` as arguments. You can export straight to a Javascript object by using the extension `.js` instead of `.json`.
|
58
58
|
There are also optional arguments: `$pretty` which defaults to `false`, but will print pretty JSON (nicely indented) if set to `true`; and `$debug` which will print debug information if set to `true`.
|
59
59
|
|
60
60
|
It converts the `$map` into either a JSON map or Javascript object through Ruby, then creates a new directory/file (or updates an existing directory/file), and writes the contents of the JSON string to it.
|
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.1"
|
11
11
|
DATE = "2014-07-24"
|
12
12
|
end
|
13
13
|
|
@@ -145,12 +145,15 @@ module Sass::Script::Functions
|
|
145
145
|
# if we're turning it straight to js put a variable name in front
|
146
146
|
ext == '.js' ? json = "var " + filename + " = " + json : json = json
|
147
147
|
|
148
|
-
# define
|
148
|
+
# define flags
|
149
149
|
flag = 'w'
|
150
150
|
flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
|
151
151
|
|
152
152
|
# open file [create new file if file does not exist], write string to root/path/to/filename.json
|
153
|
-
File.open("#{dir_path}", flag)
|
153
|
+
File.open("#{dir_path}", flag) do |file|
|
154
|
+
file.set_encoding(json.encoding) unless Sass::Util.ruby1_8?
|
155
|
+
file.print(json)
|
156
|
+
end
|
154
157
|
|
155
158
|
# define message
|
156
159
|
debug_msg = "#{ext == '.json' ? 'JSON' : 'JavaScript'} was successfully exported to #{dir_path}"
|