We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/stylus/stylus/blob/dev/lib/functions/json.js
change line 54-55
var json = JSON.parse(readFile(found, 'utf8'));
on
// read var json = readFile(found, 'utf8'); // remove comments from json json = json.replace(/((["'])(?:\\[\s\S]|.)*?\2|\/(?![*\/])(?:\\.|\[(?:\\.|.)\]|.)*?\/)|\/\/.*?$|\/\*[\s\S]*?\*\//gm,'$1'); json = JSON.parse(json);
it's work in:
$Opt=json('Variables.json', { hash: true })
Variables.json:
{ "color1:"#ffffff", // Primary color // Secondary color "color2":"#000000", /* new color */ "color3":"#999999" }
The text was updated successfully, but these errors were encountered:
replace line 55
var json = JSON5.parse(readFile(found, 'utf8'));
and add line after line 2:
, JSON5 = require('json5')
and in console:
npm install json5
and you can add JSON5 in package.json file
Sorry, something went wrong.
Did you mean support jsonc ? Json with comment is not valid json file, I think it's out of scope, but discussion is ok.
jsonc
releated project https://github.com/microsoft/node-jsonc-parser
No branches or pull requests
https://github.com/stylus/stylus/blob/dev/lib/functions/json.js
change line 54-55
on
it's work in:
Variables.json:
The text was updated successfully, but these errors were encountered: