Convert JSON formatted files into SCSS variable Maps
This plugin Requires Grunt '~0.4.0'
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
$ npm install grunt-jsontoscss --save-dev
After installing the plugin, enable it by adding the NPM load tast to your 'gruntfile.js'
grunt.loadNpmTast('grunt-jsontoscss');
Also in your 'gruntfile.js', you'll need to set up a basic task to convert the JSON to readable SASS variable maps. To do so:
grunt.initConfig({
jsonToScss: {
task_name: {
files: {
src: ["example_a.json", "example_b.json"],
dest: "_example.scss"
}
}
}
});
When this task is added to a grunt task, it will convert a single file, or multiple, properly formatted JSON files into a single SCSS file with propery formatted variable maps.