json-to-scss icon indicating copy to clipboard operation
json-to-scss copied to clipboard

Added a `keysAsVars`/`--kv` option to allow output without a wrapping object

Open 13twelve opened this issue 2 years ago • 1 comments

So, with the following JSON input.json:

{
  "foo": "bar",
  "baz": ["qux", "quux", "quuz"],
  "corge": {
    "grault": "garply",
    "waldo": "fred"
  }
}

And running json-to-scss input.json --kv, you would get:

$foo: bar;
$baz: (qux, quux, quuz);
$corge: (
  grault: garply,
  waldo: fred
);

And not:

$input: (
  foo: bar,
  baz: (qux, quux, quuz),
  corge: (
    grault: garply,
    waldo: fred
  )
);

Why?

It matches the naming of objects when using the glob mode, only from a single file. The flatten keys option totally flattens - where as this new option only removes the wrapping object.

It also happens to suit the input I wanted for @area17/scss-utilities 😉

13twelve avatar Aug 01 '22 14:08 13twelve

bump @rlapoele

13twelve avatar Apr 21 '23 08:04 13twelve