SassyJSON 1.1.1 → 1.1.2
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 +7 -0
- data/CHANGELOG.md +18 -18
- data/README.md +112 -112
- data/lib/JsonImporter.rb +228 -228
- data/lib/SassyJSON.rb +12 -14
- data/stylesheets/SassyJSON.scss +5 -5
- data/stylesheets/decode/api/_json.scss +26 -26
- data/stylesheets/decode/decode.scss +28 -28
- data/stylesheets/decode/helpers/all/_throw.scss +11 -11
- data/stylesheets/decode/helpers/all/_value.scss +49 -49
- data/stylesheets/decode/helpers/color/_color.scss +50 -50
- data/stylesheets/decode/helpers/color/_get-color-value.scss +22 -22
- data/stylesheets/decode/helpers/color/_hex-to-dec.scss +19 -19
- data/stylesheets/decode/helpers/color/_hex.scss +39 -39
- data/stylesheets/decode/helpers/color/_hsl.scss +46 -46
- data/stylesheets/decode/helpers/color/_rgb.scss +46 -46
- data/stylesheets/decode/helpers/map/_consume.scss +33 -33
- data/stylesheets/decode/helpers/number/_find-digits.scss +39 -39
- data/stylesheets/decode/helpers/number/_find-exponent.scss +51 -51
- data/stylesheets/decode/helpers/number/_find-integer.scss +37 -37
- data/stylesheets/decode/helpers/number/_pow.scss +22 -22
- data/stylesheets/decode/helpers/string/_find-ending-quote.scss +57 -57
- data/stylesheets/decode/helpers/string/_length.scss +42 -42
- data/stylesheets/decode/helpers/string/_strip-token.scss +16 -16
- data/stylesheets/decode/types/_bool.scss +40 -40
- data/stylesheets/decode/types/_list.scss +54 -54
- data/stylesheets/decode/types/_map.scss +78 -78
- data/stylesheets/decode/types/_null.scss +19 -19
- data/stylesheets/decode/types/_number.scss +63 -63
- data/stylesheets/decode/types/_string.scss +41 -41
- data/stylesheets/encode/api/_json.scss +17 -17
- data/stylesheets/encode/encode.scss +17 -17
- data/stylesheets/encode/helpers/_quote.scss +9 -9
- data/stylesheets/encode/mixins/_json.scss +36 -36
- data/stylesheets/encode/types/_bool.scss +9 -9
- data/stylesheets/encode/types/_color.scss +9 -9
- data/stylesheets/encode/types/_list.scss +13 -13
- data/stylesheets/encode/types/_map.scss +13 -13
- data/stylesheets/encode/types/_null.scss +9 -9
- data/stylesheets/encode/types/_number.scss +9 -9
- data/stylesheets/encode/types/_string.scss +9 -9
- metadata +8 -10
@@ -1,9 +1,9 @@
|
|
1
|
-
// Proof quote a value
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $value: value to be quoted
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] quoted value
|
6
|
-
|
7
|
-
@function _proof-quote($value) {
|
8
|
-
@return '"' + $value + '"';
|
9
|
-
}
|
1
|
+
// Proof quote a value
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $value: value to be quoted
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] quoted value
|
6
|
+
|
7
|
+
@function _proof-quote($value) {
|
8
|
+
@return '"' + $value + '"';
|
9
|
+
}
|
@@ -1,37 +1,37 @@
|
|
1
|
-
// JSON.stringify a value and pass it as a font-family of head element
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $value: value to be stringified
|
4
|
-
// @parem $flag: output driver
|
5
|
-
|
6
|
-
@mixin json-encode($value, $flag: all) {
|
7
|
-
$flag: if(not index(all regular media comment, $flag), all, $flag);
|
8
|
-
$json: json-encode($value);
|
9
|
-
|
10
|
-
// Persistent comment
|
11
|
-
@if $flag == comment or $flag == all {
|
12
|
-
/*! json-encode: #{$json} */
|
13
|
-
}
|
14
|
-
|
15
|
-
// Regular property value pair
|
16
|
-
@if $flag == regular or $flag == all {
|
17
|
-
// All browsers except IE8-
|
18
|
-
body::before {
|
19
|
-
display: none !important;
|
20
|
-
content: json-encode($value);
|
21
|
-
}
|
22
|
-
|
23
|
-
// All browsers except Opera (Presto based)
|
24
|
-
head {
|
25
|
-
font-family: json-encode($value);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
// Falsy media query
|
30
|
-
@if $flag == media or $flag == all {
|
31
|
-
@media -json-encode {
|
32
|
-
json {
|
33
|
-
json: $json;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
1
|
+
// JSON.stringify a value and pass it as a font-family of head element
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $value: value to be stringified
|
4
|
+
// @parem $flag: output driver
|
5
|
+
|
6
|
+
@mixin json-encode($value, $flag: all) {
|
7
|
+
$flag: if(not index(all regular media comment, $flag), all, $flag);
|
8
|
+
$json: json-encode($value);
|
9
|
+
|
10
|
+
// Persistent comment
|
11
|
+
@if $flag == comment or $flag == all {
|
12
|
+
/*! json-encode: #{$json} */
|
13
|
+
}
|
14
|
+
|
15
|
+
// Regular property value pair
|
16
|
+
@if $flag == regular or $flag == all {
|
17
|
+
// All browsers except IE8-
|
18
|
+
body::before {
|
19
|
+
display: none !important;
|
20
|
+
content: json-encode($value);
|
21
|
+
}
|
22
|
+
|
23
|
+
// All browsers except Opera (Presto based)
|
24
|
+
head {
|
25
|
+
font-family: json-encode($value);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
// Falsy media query
|
30
|
+
@if $flag == media or $flag == all {
|
31
|
+
@media -json-encode {
|
32
|
+
json {
|
33
|
+
json: $json;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
37
|
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Encode a bool to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $bool: bool to be encoded
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [bool] boolean
|
6
|
-
|
7
|
-
@function _json-encode--bool($boolean) {
|
8
|
-
@return $boolean;
|
9
|
-
}
|
1
|
+
// Encode a bool to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $bool: bool to be encoded
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [bool] boolean
|
6
|
+
|
7
|
+
@function _json-encode--bool($boolean) {
|
8
|
+
@return $boolean;
|
9
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Encode a color to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $color: color to be encoded
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] encoded color
|
6
|
-
|
7
|
-
@function _json-encode--color($color) {
|
8
|
-
@return _proof-quote($color);
|
9
|
-
}
|
1
|
+
// Encode a color to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $color: color to be encoded
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] encoded color
|
6
|
+
|
7
|
+
@function _json-encode--color($color) {
|
8
|
+
@return _proof-quote($color);
|
9
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
// Encode a list to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $list: list to be encoded
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] encoded list
|
6
|
-
|
7
|
-
@function _json-encode--list($list) {
|
8
|
-
$str: "";
|
9
|
-
@each $item in $list {
|
10
|
-
$str: $str + ', ' + json-encode($item);
|
11
|
-
}
|
12
|
-
@return '[' + str-slice($str, 3) + ']';
|
13
|
-
}
|
1
|
+
// Encode a list to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $list: list to be encoded
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] encoded list
|
6
|
+
|
7
|
+
@function _json-encode--list($list) {
|
8
|
+
$str: "";
|
9
|
+
@each $item in $list {
|
10
|
+
$str: $str + ', ' + json-encode($item);
|
11
|
+
}
|
12
|
+
@return '[' + str-slice($str, 3) + ']';
|
13
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
// Encode a map to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $map: map to be encoded
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] encoded map
|
6
|
-
|
7
|
-
@function _json-encode--map($map) {
|
8
|
-
$str: "";
|
9
|
-
@each $key, $value in $map {
|
10
|
-
$str: $str + ', ' + _proof-quote($key) + ': ' + json-encode($value);
|
11
|
-
}
|
12
|
-
@return '{' + str-slice($str, 3) + '}';
|
13
|
-
}
|
1
|
+
// Encode a map to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $map: map to be encoded
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] encoded map
|
6
|
+
|
7
|
+
@function _json-encode--map($map) {
|
8
|
+
$str: "";
|
9
|
+
@each $key, $value in $map {
|
10
|
+
$str: $str + ', ' + _proof-quote($key) + ': ' + json-encode($value);
|
11
|
+
}
|
12
|
+
@return '{' + str-slice($str, 3) + '}';
|
13
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Encode `null` to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $null: `null`
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] `null`
|
6
|
-
|
7
|
-
@function _json-encode--null($null) {
|
8
|
-
@return "null";
|
9
|
-
}
|
1
|
+
// Encode `null` to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $null: `null`
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] `null`
|
6
|
+
|
7
|
+
@function _json-encode--null($null) {
|
8
|
+
@return "null";
|
9
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Encode a number to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $number: number to be encoded
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] encoded number
|
6
|
-
|
7
|
-
@function _json-encode--number($number) {
|
8
|
-
@return if(unitless($number), $number, _proof-quote($number));
|
9
|
-
}
|
1
|
+
// Encode a number to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $number: number to be encoded
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] encoded number
|
6
|
+
|
7
|
+
@function _json-encode--number($number) {
|
8
|
+
@return if(unitless($number), $number, _proof-quote($number));
|
9
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
// Encode a string to JSON
|
2
|
-
// --------------------------------------------------------------------------------
|
3
|
-
// @param $string: string to be encoded
|
4
|
-
// --------------------------------------------------------------------------------
|
5
|
-
// @return [string] encoded string
|
6
|
-
|
7
|
-
@function _json-encode--string($string) {
|
8
|
-
@return _proof-quote($string);
|
9
|
-
}
|
1
|
+
// Encode a string to JSON
|
2
|
+
// --------------------------------------------------------------------------------
|
3
|
+
// @param $string: string to be encoded
|
4
|
+
// --------------------------------------------------------------------------------
|
5
|
+
// @return [string] encoded string
|
6
|
+
|
7
|
+
@function _json-encode--string($string) {
|
8
|
+
@return _proof-quote($string);
|
9
|
+
}
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SassyJSON
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Hugo Giraudel
|
@@ -20,10 +19,11 @@ executables: []
|
|
20
19
|
extensions: []
|
21
20
|
extra_rdoc_files: []
|
22
21
|
files:
|
23
|
-
- README.md
|
24
22
|
- CHANGELOG.md
|
23
|
+
- README.md
|
25
24
|
- lib/JsonImporter.rb
|
26
25
|
- lib/SassyJSON.rb
|
26
|
+
- stylesheets/SassyJSON.scss
|
27
27
|
- stylesheets/decode/api/_json.scss
|
28
28
|
- stylesheets/decode/decode.scss
|
29
29
|
- stylesheets/decode/helpers/all/_throw.scss
|
@@ -59,31 +59,29 @@ files:
|
|
59
59
|
- stylesheets/encode/types/_null.scss
|
60
60
|
- stylesheets/encode/types/_number.scss
|
61
61
|
- stylesheets/encode/types/_string.scss
|
62
|
-
- stylesheets/SassyJSON.scss
|
63
62
|
homepage: https://github.com/HugoGiraudel/SassyJSON/
|
64
63
|
licenses: []
|
64
|
+
metadata: {}
|
65
65
|
post_install_message:
|
66
66
|
rdoc_options: []
|
67
67
|
require_paths:
|
68
68
|
- lib
|
69
69
|
- stylesheets
|
70
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
-
none: false
|
72
71
|
requirements:
|
73
|
-
- -
|
72
|
+
- - ">="
|
74
73
|
- !ruby/object:Gem::Version
|
75
74
|
version: '0'
|
76
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
-
none: false
|
78
76
|
requirements:
|
79
|
-
- -
|
77
|
+
- - ">="
|
80
78
|
- !ruby/object:Gem::Version
|
81
79
|
version: 1.3.6
|
82
80
|
requirements: []
|
83
81
|
rubyforge_project: SassyJSON
|
84
|
-
rubygems_version:
|
82
|
+
rubygems_version: 2.2.1
|
85
83
|
signing_key:
|
86
|
-
specification_version:
|
84
|
+
specification_version: 4
|
87
85
|
summary: SassyJSON is a Sass-powered API for JSON. It provides you the classic json-encode
|
88
86
|
and json-decode directly from your Sass files.
|
89
87
|
test_files: []
|