Generate SASS/SCSS vars files out of a JSON
JavaScript CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.md
index.js
package.json

README.md

json2sass

Generate SASS/SCSS vars files out of a JSON

It turns this:

{
    "/*": "This is a special comment",
    "button": {
        "//": "This is a simple comment",
        "color": "green",
        "padding": "10px",
        "font": {
            "family": "'Helvetica Arial sans-serif'",
            "color": "white"
        }
    }
}

Into this:

/**
 * This is a special comment
 */

// This is a simple comment
$button-color: green
$button-padding: 10px
$button-font-family: 'Helvetica Arial sans-serif'
$button-font-color: white

dependencies

  • Nodejs

usage

Using as a module:

var json2sass = require('json2sass');
json2sass.toSass('path/to/existing.json', 'path/to/created.sass');
json2sass.toScss('path/to/existing.json', 'path/to/created.scss');

Or by cloning the repo:

node . --input path/to/existing.json --output path/to/created.sass
node . --input path/to/existing.json --output path/to/created.scss --type scss