0

I have a cssnext file containing global colours, example:

// ../properties.css
:root{
  --colourOne:#000000
  --colourTwo:#000001
}

I wish to parse these to a JSON object so that editing the colours may automatically update the styleguide where applicable.

Is it possible to parse this/how do I do it?

Found this: https://www.npmjs.com/package/jsonify-css but it doesn't seem to be installing for me.

Other technologies being used:

  • React
  • Styleguidist
  • Webpack

Thanks for help

Jareth
  • 123
  • 1
  • 9

1 Answers1

0

I suggest using the cssjson-cli library:

> npm install -g cssjson-cli
> cssjson style.css --output style.js
Duncan Thacker
  • 5,073
  • 1
  • 10
  • 20
  • Hi, I tried using cssjson but **not the cli**, as this would be more like what I wanted. Unfortunately (I think due to the CSS format) it responds with empty objects. – Jareth Sep 11 '17 at 09:39