How to get values from a JSON and pass as SASS variables with Grunt

0

I need to compile templates using grunt and I want to put the color settings inside a JSON file that will be inside each layout folder, ie I need to use Grunt to read the JSON and pass the values as variables to compile the SASS.

    
asked by anonymous 28.09.2015 / 21:17

1 answer

0

There is this plugin for Grunt link

Installation

npm install grunt-json-to-sass --save-dev

Configuration

grunt.initConfig({
  json_to_sass: {
    your_target: {
      files: [
        {
          src: [
            'example.json'
          ],
          dest: '_example.scss'
        }
      ]
    },
  },
});

I hope it helps!

    
29.03.2016 / 23:19