SassyExport 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +57 -57
- data/lib/SassyExport.rb +34 -34
- data/stylesheets/SassyExport.scss +16 -17
- metadata +10 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fffc63a13ea994109caaa2290d0ae5b4f1930a33
|
4
|
+
data.tar.gz: 58fde167195dfe52abc617ab5d2271d979a72f5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e2cb0a373834b19c4cb35d2e11d02872ab1d74bad20ac2ccc491d2754eb6ac28a2cb1f70f5e0d9694df136e1b755d605956012fc7b9dce385247df13bcb9380c
|
7
|
+
data.tar.gz: 2b9ec1b7768a7b5f563b0bbcffcda87cec36cdd648a5d70522bcd18f5842089d5c3e248feefb362114fa932a614c1d544b03269c7c4032200e783df12d3aa76d
|
data/README.md
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
# SassyExport [![Gem Version](https://badge.fury.io/rb/SassyExport.svg)](http://badge.fury.io/rb/SassyExport)
|
2
|
-
|
3
|
-
SassyExport is a lightweight plugin for [SassyJSON](https://github.com/HugoGiraudel/SassyJSON) that allows you to export an encoded Sass map into an external JSON file. Use it anyway you like.
|
4
|
-
|
5
|
-
## Installation
|
6
|
-
|
7
|
-
1. `gem install SassyExport`
|
8
|
-
2. Add `require "SassyExport"` to your `config.rb`
|
9
|
-
3. Import into your stylesheet with `@import "SassyExport";`
|
10
|
-
|
11
|
-
## Documentation
|
12
|
-
|
13
|
-
#### Setup
|
14
|
-
|
15
|
-
Our file structure,
|
16
|
-
```
|
17
|
-
root
|
18
|
-
├── sass
|
19
|
-
│ ├── style.scss
|
20
|
-
|
21
|
-
config.rb
|
22
|
-
```
|
23
|
-
|
24
|
-
Sass,
|
25
|
-
```scss
|
26
|
-
// ./sass/style.scss
|
27
|
-
|
28
|
-
@import "SassyExport";
|
29
|
-
|
30
|
-
$map: (
|
31
|
-
hello: world,
|
32
|
-
);
|
33
|
-
|
34
|
-
@include SassyExport("/json
|
35
|
-
```
|
36
|
-
|
37
|
-
#### Result
|
38
|
-
|
39
|
-
New JSON file is created at `./json/hello.json`. As you can see, `$path` is relative to where your `config.rb` is located. Simply calling `@include SassyExport("/
|
40
|
-
```json
|
41
|
-
{"hello": "world"}
|
42
|
-
```
|
43
|
-
|
44
|
-
#### Breakdown
|
45
|
-
|
46
|
-
The `json_export()` mixin takes a directory `$path`,
|
47
|
-
|
48
|
-
Enjoy.
|
49
|
-
|
50
|
-
## SassyJSON
|
51
|
-
|
52
|
-
* [Download SassyJSON](https://github.com/HugoGiraudel/SassyJSON)
|
53
|
-
|
54
|
-
## Credits
|
55
|
-
|
56
|
-
* [Fabrice Weinberg](http://twitter.com/fweinb)
|
57
|
-
* [Hugo Giraudel](http://twitter.com/hugogiraudel)
|
1
|
+
# SassyExport [![Gem Version](https://badge.fury.io/rb/SassyExport.svg)](http://badge.fury.io/rb/SassyExport)
|
2
|
+
|
3
|
+
SassyExport is a lightweight plugin for [SassyJSON](https://github.com/HugoGiraudel/SassyJSON) that allows you to export an encoded Sass map into an external JSON file. Use it anyway you like.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
1. `gem install SassyExport`
|
8
|
+
2. Add `require "SassyExport"` to your `config.rb`
|
9
|
+
3. Import into your stylesheet with `@import "SassyExport";`
|
10
|
+
|
11
|
+
## Documentation
|
12
|
+
|
13
|
+
#### Setup
|
14
|
+
|
15
|
+
Our file structure,
|
16
|
+
```
|
17
|
+
root
|
18
|
+
├── sass
|
19
|
+
│ ├── style.scss
|
20
|
+
├── json
|
21
|
+
└── config.rb
|
22
|
+
```
|
23
|
+
|
24
|
+
Sass,
|
25
|
+
```scss
|
26
|
+
// ./sass/style.scss
|
27
|
+
|
28
|
+
@import "SassyExport";
|
29
|
+
|
30
|
+
$map: (
|
31
|
+
hello: world,
|
32
|
+
);
|
33
|
+
|
34
|
+
@include SassyExport("/json/hello.json", $map);
|
35
|
+
```
|
36
|
+
|
37
|
+
#### Result
|
38
|
+
|
39
|
+
New JSON file is created at `./json/hello.json`. As you can see, `$path` is relative to where your `config.rb` is located. Simply calling `@include SassyExport("/hello.json", $map)` will write to your directory root.
|
40
|
+
```json
|
41
|
+
{"hello": "world"}
|
42
|
+
```
|
43
|
+
|
44
|
+
#### Breakdown
|
45
|
+
|
46
|
+
The `json_export()` mixin takes a directory/filename.json `$path`, and a Sass `$map` as arguments. It then converts the `$map` into a JSON map with SassyJSON's `json_encode()` function, then Ruby creates a new file (or updates an existing file), and writes the contents of the json string to it. I'm no Ruby expert, so if you belive that you could improve the small amount of code here, feel free to.
|
47
|
+
|
48
|
+
Enjoy.
|
49
|
+
|
50
|
+
## SassyJSON
|
51
|
+
|
52
|
+
* [Download SassyJSON](https://github.com/HugoGiraudel/SassyJSON)
|
53
|
+
|
54
|
+
## Credits
|
55
|
+
|
56
|
+
* [Fabrice Weinberg](http://twitter.com/fweinb)
|
57
|
+
* [Hugo Giraudel](http://twitter.com/hugogiraudel)
|
data/lib/SassyExport.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
# SassyExport is a lightweight plugin for SassyJSON
|
2
|
-
# ----------------------------------------------------------------------------------------------------
|
3
|
-
# @dependency https://github.com/HugoGiraudel/SassyJSON
|
4
|
-
# ----------------------------------------------------------------------------------------------------
|
5
|
-
|
6
|
-
require "SassyJSON"
|
7
|
-
|
8
|
-
extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
9
|
-
Compass::Frameworks.register('SassyExport', :path => extension_path)
|
10
|
-
|
11
|
-
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
12
|
-
# Date is in the form of YYYY-MM-DD
|
13
|
-
module SassyExport
|
14
|
-
VERSION = "1.0.
|
15
|
-
DATE = "2014-
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
# ----------------------------------------------------------------------------------------------------
|
20
|
-
# @param path [string] : directory path to write string
|
21
|
-
# @param filename [string] : file name to write to path
|
22
|
-
# @param string [string] : json to write to filename
|
23
|
-
# ----------------------------------------------------------------------------------------------------
|
24
|
-
# @return string | write filename to path
|
25
|
-
|
26
|
-
module Sass::Script::Functions
|
27
|
-
def SassyExport(path,
|
28
|
-
# define root path up to current
|
29
|
-
root = Dir.pwd
|
30
|
-
# open file [create new file if file does not exist], write
|
31
|
-
File.open("#{root}#{path}
|
32
|
-
# return string for use in css
|
33
|
-
return string
|
34
|
-
end
|
1
|
+
# SassyExport is a lightweight plugin for SassyJSON
|
2
|
+
# ----------------------------------------------------------------------------------------------------
|
3
|
+
# @dependency https://github.com/HugoGiraudel/SassyJSON
|
4
|
+
# ----------------------------------------------------------------------------------------------------
|
5
|
+
|
6
|
+
require "SassyJSON"
|
7
|
+
|
8
|
+
extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
9
|
+
Compass::Frameworks.register('SassyExport', :path => extension_path)
|
10
|
+
|
11
|
+
# Version is a number. If a version contains alphas, it will be created as a prerelease version
|
12
|
+
# Date is in the form of YYYY-MM-DD
|
13
|
+
module SassyExport
|
14
|
+
VERSION = "1.0.14"
|
15
|
+
DATE = "2014-06-02"
|
16
|
+
end
|
17
|
+
|
18
|
+
# SassyExport : write passed json string to path/to/filename.json
|
19
|
+
# ----------------------------------------------------------------------------------------------------
|
20
|
+
# @param path [string] : directory path to write string
|
21
|
+
# @param filename [string] : file name to write to path
|
22
|
+
# @param string [string] : json to write to filename
|
23
|
+
# ----------------------------------------------------------------------------------------------------
|
24
|
+
# @return string | write filename to path
|
25
|
+
|
26
|
+
module Sass::Script::Functions
|
27
|
+
def SassyExport(path, json)
|
28
|
+
# define root path up to current working directory
|
29
|
+
root = Dir.pwd
|
30
|
+
# open file [create new file if file does not exist], write string to root/path/to/filename.json
|
31
|
+
File.open("#{root}#{path}", "w") { |f| f.write(json) }
|
32
|
+
# return string for use in css
|
33
|
+
return string
|
34
|
+
end
|
35
35
|
end
|
@@ -1,18 +1,17 @@
|
|
1
|
-
@import "SassyJSON";
|
2
|
-
|
3
|
-
// ----------------------------------------------------------------------------------------------------
|
4
|
-
//
|
5
|
-
// ----------------------------------------------------------------------------------------------------
|
6
|
-
// @param $path [string] : directory path to write
|
7
|
-
// @param $
|
8
|
-
//
|
9
|
-
//
|
10
|
-
|
11
|
-
|
12
|
-
@
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
}
|
1
|
+
@import "SassyJSON";
|
2
|
+
|
3
|
+
// ----------------------------------------------------------------------------------------------------
|
4
|
+
// SassyExport : write passed json string to $path/to/filename.json
|
5
|
+
// ----------------------------------------------------------------------------------------------------
|
6
|
+
// @param $path [string] : directory path and filename to write
|
7
|
+
// @param $map [map] : map to write to filename
|
8
|
+
// ----------------------------------------------------------------------------------------------------
|
9
|
+
// @return creates placeholder | write filename to path
|
10
|
+
|
11
|
+
@mixin SassyExport($path, $map) {
|
12
|
+
@at-root {
|
13
|
+
%SassyExport {
|
14
|
+
content: "#{SassyExport(unquote($path), unquote(json_encode($map)))}";
|
15
|
+
}
|
16
|
+
}
|
18
17
|
}
|
metadata
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SassyExport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.14
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ezekiel Gabrielse
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: SassyJSON
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.1.7
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.1.7
|
30
27
|
description: SassyExport is a lightweight plugin for SassyJSON that allows you to
|
@@ -35,33 +32,32 @@ executables: []
|
|
35
32
|
extensions: []
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
35
|
+
- README.md
|
38
36
|
- lib/SassyExport.rb
|
39
37
|
- stylesheets/SassyExport.scss
|
40
|
-
- README.md
|
41
38
|
homepage: https://github.com/ezekg/SassyExport/
|
42
39
|
licenses:
|
43
40
|
- MIT
|
41
|
+
metadata: {}
|
44
42
|
post_install_message:
|
45
43
|
rdoc_options: []
|
46
44
|
require_paths:
|
47
45
|
- lib
|
48
46
|
- stylesheets
|
49
47
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
48
|
requirements:
|
52
|
-
- -
|
49
|
+
- - ">="
|
53
50
|
- !ruby/object:Gem::Version
|
54
51
|
version: '0'
|
55
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
53
|
requirements:
|
58
|
-
- -
|
54
|
+
- - ">="
|
59
55
|
- !ruby/object:Gem::Version
|
60
56
|
version: 1.3.6
|
61
57
|
requirements: []
|
62
58
|
rubyforge_project: SassyExport
|
63
|
-
rubygems_version:
|
59
|
+
rubygems_version: 2.2.2
|
64
60
|
signing_key:
|
65
|
-
specification_version:
|
61
|
+
specification_version: 4
|
66
62
|
summary: SassyExport allows you to export a Sass map into an external JSON file.
|
67
63
|
test_files: []
|