SassyExport 1.0.11 → 1.0.12
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.
- data/README.md +11 -2
- data/lib/SassyExport.rb +2 -2
- metadata +1 -1
data/README.md
CHANGED
@@ -12,6 +12,15 @@ SassyExport is a lightweight plugin for [SassyJSON](https://github.com/HugoGirau
|
|
12
12
|
|
13
13
|
#### Setup
|
14
14
|
|
15
|
+
Our file structure,
|
16
|
+
```
|
17
|
+
root
|
18
|
+
├── sass
|
19
|
+
│ ├── style.scss
|
20
|
+
└── json
|
21
|
+
```
|
22
|
+
|
23
|
+
Sass,
|
15
24
|
```scss
|
16
25
|
// ./sass/style.scss
|
17
26
|
|
@@ -21,12 +30,12 @@ $map: (
|
|
21
30
|
hello: world,
|
22
31
|
);
|
23
32
|
|
24
|
-
@include SassyExport("
|
33
|
+
@include SassyExport("/json", "hello", $map);
|
25
34
|
```
|
26
35
|
|
27
36
|
#### Result
|
28
|
-
New JSON file is created in `./json/hello.json`
|
29
37
|
|
38
|
+
New JSON file is created in `./json/hello.json`. As you can see, `$path` is relative to where your `config.rb` is located. Simply calling `@include SassyExport("/", "hello", $map)` will write to your directory root.
|
30
39
|
```json
|
31
40
|
{"hello": "world"}
|
32
41
|
```
|
data/lib/SassyExport.rb
CHANGED
@@ -11,7 +11,7 @@ Compass::Frameworks.register('SassyExport', :path => extension_path)
|
|
11
11
|
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
12
12
|
# Date is in the form of YYYY-MM-DD
|
13
13
|
module SassyExport
|
14
|
-
VERSION = "1.0.
|
14
|
+
VERSION = "1.0.12"
|
15
15
|
DATE = "2014-05-31"
|
16
16
|
end
|
17
17
|
|
@@ -28,7 +28,7 @@ module Sass::Script::Functions
|
|
28
28
|
# define root path up to current folder
|
29
29
|
root = Dir.pwd
|
30
30
|
# open file [create new file if file does not exist], write $string to $root/$path/$filename
|
31
|
-
File.open("#{root}
|
31
|
+
File.open("#{root}#{path}/#{filename}.json", "w") { |f| f.write(string) }
|
32
32
|
# return string for use in css
|
33
33
|
return string
|
34
34
|
end
|