less-vars-loader

1.1.0 • Public • Published

less-vars-loader

Build status npm npm David node Commitizen friendly semantic-release Code Climate

webpack loader to load variables from less files

Install

npm install --save-dev less-vars-loader

Usage

// some.less 
@my-var: 2px;
const vars = require("less-vars-loader!./some.less");
// vars == { 'my-var': '2px' }

Camel casing (?camelCase)

The exported keys can be camelCased. This is disabled by default.

const vars = require("less-vars-loader?camelCase!./some.less");
// vars == { myVar: '2px' }

Resolving variables (?resolveVariables)

For simple @x = @y assignments this module can follow the assigned variable replace it with the last assignment. This is disabled by default.

Attention: Circular assignments are not supported, neither are non-trivial assignment such as calculations.

// some.less 
@a: 1px;
@b: @a;
@c: @b;
const vars = require("less-vars-loader?resolveVariables!./some.less");
// vars == { a: '1px', b: '1px', c: '1px' }

TODO

  • source map support

Readme

Keywords

Package Sidebar

Install

npm i less-vars-loader

Weekly Downloads

3,672

Version

1.1.0

License

MIT

Last publish

Collaborators

  • joscha