less-vars-loader
v1.1.0
Published
webpack loader to load variables from less files
Downloads
10,697
Readme
less-vars-loader
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