isv-rx-styler

10.0.9 • Public • Published

API

  • validate

  /* check a JSON Object with one property ,validate support of css property ,try  fix color to Hex , log errors & warnings
  * @param {object} json  , a decl node by postcss
  * JSON Object example:
   json {
    'raws': {},
    'type': 'decl',
    'source': {
      'start': {
        line: 17,
        column: 5
      },
      'end': {
        line: 17,
        column: 17
      }
    },
    'prop': 'background-color',
    'value': 'red'
  }
  * return  {
    jsonStyle: json
    log: {
      line: 17
      column: 17,
      reason: 'INFO: `background-color` property value `red` is autofixed to `#FF0000`',
      level: info
    }
  }
  */

  var rxStyler = require('@ali/rx-styler');
  var code = {
    'raws': {},
    'type': 'decl',
    'source': {
      'start': {
        'line': '17',
        'column': '5'
      },
      'end': {
        'line': '17',
        'column': '17'
      }
    },
    'prop': 'color',
    'value': 'red'
  };

  data = rx.validate(code);

Readme

Keywords

Package Sidebar

Install

npm i isv-rx-styler

Weekly Downloads

1

Version

10.0.9

License

ISC

Last publish

Collaborators

  • smalldragonluo