grunt-scss2json v0.1.13
grunt-scss2json
This plugin parses the .scss files containing configuration variables and returns one / many json file(s) containing the json representation of these variables, used to build the UI elements for the frontend application
Getting Started
This plugin requires Grunt ~0.4.5
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-scss2json --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-scss2json');
The "scss2json" task
Overview
In your project's Gruntfile, add a section named scss2json
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
scss2json: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
Options
options.pretty
Type: Boolean
Default value: false
When this is true, the json string to be placed into the output file will be formatted.
Usage Examples
Default Options
In this example, the default options are used to do something with whatever. So if the testing
file has the content Testing
and the 123
file had the content 1 2 3
, the generated result would be Testing, 1 2 3.
grunt.initConfig({
scss2json: {
default: {
options: {
pretty: false,
},
files: [ {src: '<%= globalVars.scss2jsonSrc %>', dest: '<%= globalVars.scss2jsonDest %>'} ]
},
pretty: {
options: {
pretty: true
},
files: [ {src: '<%= globalVars.scss2jsonSrc %>', dest: '<%= globalVars.scss2jsonDest %>'} ]
}
},
});
Release History
0.1.4 - 2016.04.06