项目作者: laurenhamel

项目描述 :
Convert JSON to SASS with Grunt
高级语言: JavaScript
项目地址: git://github.com/laurenhamel/grunt-sasson.git
创建时间: 2017-08-25T20:44:52Z
项目社区:https://github.com/laurenhamel/grunt-sasson

开源协议:MIT License

下载


grunt-sasson

Convert JSON to SASS with Grunt

Getting Started

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:

  1. npm install grunt-sasson --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

  1. grunt.loadNpmTasks('grunt-sasson');

Sasson task

Run this task with the grunt sasson command.

Options

useMap

Type: Boolean
Default: true

Output the Sass in maps instead of variables.

varName

Type: String
Default: null

Set the map name when options.useMap is true, or use it to add a namespace prefix to variable names.

doubleQuotes

Type: Boolean
Default: true

Use double quotes for escaping string values and map keys when true or single quotes when false.

tabSpaces

Type: Integer
Default: 2

The number of spaces to use when applying indentation.

Examples

Add a section named sasson to the data object passed into grunt.initConfig().

  1. grunt.initConfig({
  2. sasson: {
  3. target: {
  4. options: {
  5. useMap: true,
  6. varName: 'config',
  7. doubleQuotes: true,
  8. tabSpaces: 2
  9. },
  10. files: [{
  11. src: ['input.json'],
  12. dest: 'scss/'
  13. ]}
  14. }
  15. }
  16. });
  17. grunt.loadNpmTasks('grunt-sasson');
  18. grunt.registerTask('default', ['sasson']);

Sass files will be stored in your dest folder and formatted as partials (e.g., _output.scss), and the input file name will be applied to the output file.