sass-json-vars 0.3.2 → 0.3.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35752407d8d32e59704d19bfa5996091cab97921
4
- data.tar.gz: 5286c5e298cf7136dcaef29b36231e10d71cfa76
3
+ metadata.gz: d9092fdab6ba204da63c33f61b8ece2c93972d17
4
+ data.tar.gz: d92eb0be9ab3e178df3de3dd32184d18dc08d9e7
5
5
  SHA512:
6
- metadata.gz: 8cec12e1b9af79066612bd52ae3ced0ea576bb3277d619a808620e28d439249c87e50a9295cf75662ebf016ba720c55d665d7906e6d0d3121645cdaa2c1589a0
7
- data.tar.gz: f6d16d35f9a7cd2faf25ffda1f58a9f14ba7584f66c26f24df7ff2de161155dc461859b8abc5d02ef1de09a896f061152723529f1030e85b2e20ee014806bd2c
6
+ metadata.gz: d8edb745f7b09db21533ac174be66bebdecf6da492b353934bcef24e3c82193148d1134e0d8ffa8487ac3d9f50a526cb08f53ab0e47951fd7a1a7d7a4051c02a
7
+ data.tar.gz: ebb20ad02ec38c7e45099f1aa7e3009bcdb7fa395ab8a3206f39683dcd343436cb05c47907c5925abd2633b6a746b5d960e21a8bad892a0b97be5bb5b9fd604b
@@ -43,7 +43,7 @@ module SassJSONVars
43
43
  elsif item.is_a? Hash
44
44
  _make_map(item)
45
45
  else
46
- item
46
+ item.to_s
47
47
  end
48
48
  end
49
49
 
@@ -1,3 +1,3 @@
1
1
  module SassJSONVars
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/readme.md CHANGED
@@ -16,7 +16,9 @@
16
16
  gem install sass-json-vars
17
17
  ```
18
18
 
19
- #### For projects using Sass >= 3.3
19
+ After that reload rails server if you are on rails.
20
+
21
+ #### For projects using Sass >= 3.3
20
22
 
21
23
 
22
24
  Place variables in a JSON file:
@@ -77,3 +79,11 @@ Require sass-json-vars when compiling
77
79
  ```shell
78
80
  sass style.scss -r sass-json-vars
79
81
  ```
82
+
83
+ ### What about node-sass?
84
+
85
+ Take a look at
86
+ [node-sass-json-importer](https://github.com/Updater/node-sass-json-importer)
87
+ for a libsass variant of this project:
88
+
89
+ https://github.com/Updater/node-sass-json-importer
@@ -0,0 +1,7 @@
1
+ @import 'variables.json';
2
+
3
+ body {
4
+ @if $value {
5
+ color: blue;
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "value": true
3
+ }
@@ -1,5 +1,5 @@
1
1
  @import 'variables.json';
2
2
 
3
3
  body {
4
- color: map-get($colors, red);
5
- }
4
+ color: map-get(map-get($colors, red), base);
5
+ }
@@ -1,5 +1,7 @@
1
1
  {
2
- "colors" : {
3
- "red": "#c33"
2
+ "colors": {
3
+ "red" : {
4
+ "base": "#c33"
4
5
  }
6
+ }
5
7
  }
@@ -0,0 +1,7 @@
1
+ @import 'variables.json';
2
+
3
+ body {
4
+ @if map-get($bool, isRed) {
5
+ color: red;
6
+ }
7
+ }
@@ -0,0 +1,5 @@
1
+ @import 'variables.json';
2
+
3
+ body {
4
+ padding: map-get($number, padding) + 0px;
5
+ }
@@ -0,0 +1,5 @@
1
+ @import 'variables.json';
2
+
3
+ body {
4
+ color: map-get($string, red);
5
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "bool": {
3
+ "isRed" : true
4
+ },
5
+ "string": {
6
+ "red": "red"
7
+ },
8
+ "number": {
9
+ "padding": 10
10
+ }
11
+ }
@@ -18,4 +18,24 @@ class SassJSONVarsTest < Test::Unit::TestCase
18
18
  scss = Sass.compile_file("test/fixtures/maps/style.scss")
19
19
  assert_equal "body {\n color: #cc3333; }\n", scss
20
20
  end
21
+
22
+ def test_booleans
23
+ scss = Sass.compile_file("test/fixtures/booleans/style.scss")
24
+ assert_equal "body {\n color: blue; }\n", scss
25
+ end
26
+
27
+ def test_nesting_booleans
28
+ scss = Sass.compile_file("test/fixtures/nesting/booleans.scss")
29
+ assert_equal "body {\n color: red; }\n", scss
30
+ end
31
+
32
+ def test_nesting_strings
33
+ scss = Sass.compile_file("test/fixtures/nesting/strings.scss")
34
+ assert_equal "body {\n color: red; }\n", scss
35
+ end
36
+
37
+ def test_nesting_numbers
38
+ scss = Sass.compile_file("test/fixtures/nesting/numbers.scss")
39
+ assert_equal "body {\n padding: 10px; }\n", scss
40
+ end
21
41
  end
metadata CHANGED
@@ -1,58 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-json-vars
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate Hunzaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: simplecov
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.7.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.7.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coveralls
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: Allows the use of JSON to declare variables with @import 'file.json'.
55
+ description: A Ruby Sass custom importer that allows the use of JSON to declare variables
56
+ with @import 'file.json'.
56
57
  email:
57
58
  - nate.hunzaker@viget.com
58
59
  executables: []
@@ -65,10 +66,16 @@ files:
65
66
  - lib/sass-json-vars/monkeypatch.rb
66
67
  - lib/sass-json-vars/version.rb
67
68
  - readme.md
69
+ - test/fixtures/booleans/style.scss
70
+ - test/fixtures/booleans/variables.json
68
71
  - test/fixtures/lists/style.scss
69
72
  - test/fixtures/lists/variables.json
70
73
  - test/fixtures/maps/style.scss
71
74
  - test/fixtures/maps/variables.json
75
+ - test/fixtures/nesting/booleans.scss
76
+ - test/fixtures/nesting/numbers.scss
77
+ - test/fixtures/nesting/strings.scss
78
+ - test/fixtures/nesting/variables.json
72
79
  - test/fixtures/sass/style.sass
73
80
  - test/fixtures/sass/variables.json
74
81
  - test/fixtures/strings/style.scss
@@ -87,12 +94,12 @@ require_paths:
87
94
  - lib
88
95
  required_ruby_version: !ruby/object:Gem::Requirement
89
96
  requirements:
90
- - - '>='
97
+ - - ">="
91
98
  - !ruby/object:Gem::Version
92
99
  version: '0'
93
100
  required_rubygems_version: !ruby/object:Gem::Requirement
94
101
  requirements:
95
- - - '>='
102
+ - - ">="
96
103
  - !ruby/object:Gem::Version
97
104
  version: '0'
98
105
  requirements: []
@@ -102,10 +109,16 @@ signing_key:
102
109
  specification_version: 4
103
110
  summary: Allows the use of JSON to declare variables with @import 'file.json'.
104
111
  test_files:
112
+ - test/fixtures/booleans/style.scss
113
+ - test/fixtures/booleans/variables.json
105
114
  - test/fixtures/lists/style.scss
106
115
  - test/fixtures/lists/variables.json
107
116
  - test/fixtures/maps/style.scss
108
117
  - test/fixtures/maps/variables.json
118
+ - test/fixtures/nesting/booleans.scss
119
+ - test/fixtures/nesting/numbers.scss
120
+ - test/fixtures/nesting/strings.scss
121
+ - test/fixtures/nesting/variables.json
109
122
  - test/fixtures/sass/style.sass
110
123
  - test/fixtures/sass/variables.json
111
124
  - test/fixtures/strings/style.scss