@solidpixels/less-plugin-json

    0.2.0 • Public • Published

    JSON less.js file manager

    Usage

    In LESS file, you can import JSON file as variables file. Regular JSON property will be flattened with -- separator. To produce LESS maps or lists, prefix variable with dollar.

    {
      "border": {
        "size": "10px",
        "color": "red"
      },
      "$features": ["a", "b"],
      "$colors": {
        "red": "#ff0000",
        "green": "#00ff00"
      }
    }
    @import './variables.json';
    
    body {
      border: @border--size @border--color;
      features: @features;
      color: @colors[red];
    }

    Will compile to:

    body {
      border: 10px red;
      features: a, b;
      colors red;
    }

    Use

    lessc style.less --plugin=index.js

    Inspired by https://github.com/fortes/less-plugin-load-json#readme.

    Keywords

    Install

    npm i @solidpixels/less-plugin-json

    DownloadsWeekly Downloads

    10

    Version

    0.2.0

    License

    ISC

    Unpacked Size

    4.28 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar
    • avatar