Installations
npm install node-sass-functions-json
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
7.10.0
NPM Version
4.2.0
Score
48.7
Supply Chain
88.3
Quality
70.7
Maintenance
40
Vulnerability
92.8
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (63.93%)
CSS (36.07%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
itgalaxy
Download Statistics
Total Downloads
8,465
Last Day
1
Last Week
5
Last Month
25
Last Year
847
GitHub Statistics
MIT License
3 Stars
83 Commits
1 Forks
4 Watchers
177 Branches
3 Contributors
Updated on Mar 02, 2019
Bundle Size
28.79 kB
Minified
10.33 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.0
Package Id
node-sass-functions-json@1.0.0
Size
5.25 kB
NPM Version
4.2.0
Node Version
7.10.0
Total Downloads
Cumulative downloads
Total Downloads
8,465
Peer Dependencies
1
Dev Dependencies
28
node-sass-functions-json
JSON encode and decode functions for node-sass.
Install
1npm install node-sass-functions-json --save
Usage
1const sass = require('node-sass'); 2const jsonFunctions = require('node-sass-functions-json'); 3 4sass.render({ 5 file: './index.scss', 6 functions: Object.assign({}, jsonFunctions) 7}, function (error, result) { 8 // ... 9});
Module exports object with prepared functions json-encode
and json-decode
.
If you need functions as separate entities, they are available as static properties encode
and decode
.
Encode
Input:
1$list: 1, 2, "3", (4,5,6), (foo: "bar baz"); 2$map: ( 3 foo: 1, 4 bar: (2, 3), 5 baz: "3 3 3", 6 bad: ( 7 foo: 11, 8 bar: 22, 9 baz: ( 10 5, 4, 6, null, 1, 1.23456789px 11 ), 12 bag: "foo bar" 13 ), 14 qux: rgba(255,255,255,0.5), 15 corgle: red 16); 17 18body { 19 content: json-encode($list); 20 content: json-encode($map); 21 content: json-encode($list, $quotes: false); 22 content: json-encode($map, $quotes: false); 23}
Output:
1body { 2 content: '[1,2,"3",[4,5,6],{"foo":"bar baz"}]'; 3 content: '{"foo":1,"bar":[2,3],"baz":"3 3 3","bad":{"foo":11,"bar":22,"baz":[5,4,6,null,1,"1.23457px"],"bag":"foo bar"},"qux":"rgba(255,255,255,0.5)","corgle":"#f00"}'; 4 content: [1,2,"3",[4,5,6],{"foo":"bar baz"}]; 5 content: {"foo":1,"bar":[2,3],"baz":"3 3 3","bad":{"foo":11,"bar":22,"baz":[5,4,6,null,1,"1.23457px"],"bag":"foo bar"},"qux":"rgba(255,255,255,0.5)","corgle":"#f00"}; 6}
Decode
Input:
1$array: '[1,2,"3",[4,5,6],{"foo":"bar baz"}]'; 2$object: '{"foo":1,"bar":[2,3],"baz":"3 3 3","bad":{"foo":11,"bar":22,"baz":[5,4,6,null,1,"1.23456789px"],"bag":"foo bar"},"qux":"rgba(255,255,255,0.5)","corgle":"#f00"}'; 3 4@debug json-decode($array); 5@debug json-decode($object);
Output:
1DEBUG: 1, 2, 3, 4, 5, 6, (foo: bar baz) 2DEBUG: (foo: 1, bar: 2, 3, baz: 3 3 3, bad: (foo: 11, bar: 22, baz: 5, 4, 6, null, 1, 1.23456789px, bag: foo bar), 3 qux: rgba(255, 255, 255, 0.5), corgle: red)
API
json-encode(data, quotes)
Returns: sass.types.String
Encodes (JSON.stringify
) data
and returns Sass string.
By default, string is quoted with single quotes so that it can be easily used in standard CSS values.
-
Sass lists are transformed to arrays.
-
Sass maps are transformed to objects.
-
Sass colors are transformed to
rgba()
syntax if they have alpha value, otherwise they are transformed to hex value (and it’s shorther version if possible). -
Sass strings are transformed to strings
-
Sass numbers are transformed to numbers.
-
Sass null values and anything unresolved is transformed to null values.
data
Type: sass.types.*
Data to encode (stringify).
quotes
Type: Boolean|sass.types.Boolean
Default: true
Should output string be quoted with single quotes.
json-decode(data)
Returns: sass.types.*
Decodes (JSON.parse
) string
and returns one of available Sass types.
-
Arrays are transformed to Sass lists.
-
Objects are transformed to Sass maps.
-
Anything properly parsed with parse-color is transformed to Sass color.
-
Strings are transformed to Sass numbers with units if they can be properly parsed with parse-css-dimension, otherwise they are transformed to Sass strings.
-
Numbers are transformed to Sass numbers.
-
Null values and anything unresolved is transformed to Sass null values.
data
Type: sass.types.String|sass.types.Number|sass.types.Boolean|sass.types.Null
String to decode (parse).
Related
- node-sass-json-functions - Thanks for inspiration.
Contribution
Feel free to push your code if you agree with publishing under the MIT license.
Changelog
License

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 25 are checked with a SAST tool
Reason
82 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-8w4h-3cm3-2pm2
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-9vvw-cc9w-f27h
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-hr2v-3952-633q
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c
- Warn: Project is vulnerable to: GHSA-qh2h-chj9-jffq
- Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq
- Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm
- Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-8g7p-74h8-hg48
- Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546
- Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-2m96-9w4j-wgv7
- Warn: Project is vulnerable to: GHSA-h726-x36v-rx45
- Warn: Project is vulnerable to: GHSA-5947-m4fg-xhqg
- Warn: Project is vulnerable to: GHSA-779f-wgxg-qr8f
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-wrvr-8mpx-r7pp
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-w9mr-4mfr-499f
- Warn: Project is vulnerable to: GHSA-9v62-24cr-58cx
- Warn: Project is vulnerable to: GHSA-r8f7-9pfq-mjmv
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-7mwh-4pqv-wmr8
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6
- Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj
- Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3
- Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7
- Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-g7q5-pjjr-gqvp
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-w5p7-h5w8-2hfq
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
1.7
/10
Last Scanned on 2025-03-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to node-sass-functions-json
node-sass-json-functions
JSON encode and decode functions for node-sass.
node-sass-json-vars
Custom sass functions that allow using variables from JSON files.
@emiplegiaqmnpm/mollitia-rem-nihil
A [Dart][dart] implementation of [Sass][@emiplegiaqmnpm/mollitia-rem-nihil]. **Sass makes CSS fun**.