less-vars-2-json

0.1.0 • Public • Published

less-vars-2-json

Read variables from less file. Support import statement.

Example:

// colors.less
@blue1: #00f;
@blue2: #00e;
@grey1: #eee;
@grey2: #888;
@grey3: #333;

// variables.less
@import "./colors.less";
@highlight-color: @blue1;
@primary-text: @grey3;
@border: 1px solid @grey1;
const less2json = require("less-vars-2-json");
const path = require("path");
// absolute path
const lessfile = path.resolve(__dirname, "./variables.less");
const json = less2json(lessfile);

Output:

{
  blue1: '#00f',
  blue2: '#00e',
  grey1: '#eee',
  grey2: '#888',
  grey3: '#333',
  'highlight-color': '#00f',
  'primary-text': '#333',
  border: '1px solid #eee'
}

Readme

Keywords

Package Sidebar

Install

npm i less-vars-2-json

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

3.8 kB

Total Files

11

Last publish

Collaborators

  • therealzoe