acdlite / json-sass Goto Github PK
View Code? Open in Web Editor NEWTransforms a JSON stream into scss syntax Sass.
Transforms a JSON stream into scss syntax Sass.
If you have strings are have parens or other interesting characters, it'll break the sass compilation.
When installing this package via npm, I get the following warning:
npm WARN package.json [email protected] No repository field.
Documentation: https://docs.npmjs.com/files/package.json#repository
Due to the way sass works if you don't quote the maps you can have issues with map keys being other object types such as a color. e.g values like "red" getting converted into #f00 etc. This can be avoided by quoting the key.
$theme: (
Primary: (
Ocean Blue: (
model: RGB,
type: 2,
rgb: (57, 84, 216),
code: 3954d8
),
Tree Green: (
model: RGB,
type: 2,
rgb: (154, 188, 47),
code: 9abc2f
)
)
);
$theme: (
"Primary": (
"Ocean Blue": (
"model": RGB,
"type": 2,
"rgb": (57, 84, 216),
"code": 3954d8
),
"Tree Green": (
"model": RGB,
"type": 2,
"rgb": (154, 188, 47),
"code": 9abc2f
)
)
);
I'm using iojs v1.7.1. When running make watch on flummox docs, something fails in es6 compilation
=> make watch
mkdir -p sass/dependencies/ && node_modules/.bin/json-sass -i lib/shared/theme.js \
| sed '1s/^/$theme: /' \
> sass/dependencies/_theme.scss
/Users/tom/Code/Sandbox/flummox/docs/node_modules/json-sass/lib/jsonSass.js:14
var options = Object.assign({}, DEFAULTS, options);
^
TypeError: undefined is not a function
I can be worked around by removing Object.assing from jsonSass.js:14, for example using this code
// var options = Object.assign({}, DEFAULTS, options);
var options = JSON.parse(JSON.stringify(options));
options.prefix = options.prefix || "";
options.suffix = options.suffix || ";";
Not sure in which part of flummox I should report this, I'm just starting. So I put it here. Sorry for my laziness, it might be my environment problem as well.
I'm pretty new to nodeJS so please excuse any misunderstanding on how this should be used.
I'm including via var jsonSass = require( 'json-sass' ); in my JS file.
When i'm using the jsonSass.convertJs( [1,2,3] ) function I get the following console error:
'Fatal error: undefined is not a function'
I've worked around this locally by changing jsonSass.js file:
from:
exports.convertJs = jsToSassString;
to:
module.exports.convertJs = jsToSassString;
This resolves the issue, but clearly my local fix will be overwritten when building the project from scratch so this is far from ideal.
I'm not sure if this is a bug with v 1.3.5 or if my understanding of the usage is incorrect.
Any help would be greatly received.
EDIT: I've just downgraded to 1.2.1 and this has resolved the issue for me.
is possible use with compass ?
Prototype Pollution
Module: lodash
Published: February 13th 2019
Reported by: asgerf
CWE-471
CVE-2018-16487
Vulnerable: <4.17.11
Patched: >=4.17.11
Exploitability: 3
Overview
Versions of lodash before 4.17.5 are vulnerable to prototype pollution.
The vulnerable functions are 'defaultsDeep', 'merge', and 'mergeWith' which allow a malicious user to modify the prototype of Object via {constructor: {prototype: {...}}} causing the addition or modification of an existing property that will exist on all objects.
Findings
json-sass>lodash
Remediation
Update to version 4.17.11 or later.
References
I am not sure if this project is still being maintained?
Would you consider seeking a maintainer?
Anyway back to the problem at hand sending through an empty value the SCSS map is returning a none quoted SCSS map value. Which then breaks SCSS the compiler.
For example I am sending through:
{ "some-key" : { "value" : "" } }
The SCSS Map is being output as:
( some-key : ( value: ) )
Ideally this would be output as:
( some-key : ( value: "" ) )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.