PostCSS LESS Variables
PostCSS plugin for less-like variables.
You can use variables inside values, selectors and at-rule’s parameters.
@@
If you want be closer to W3C spec, you should use postcss-custom-properties plugin.
Also you should look at postcss-map for big complicated configs.
Interpolation
There is special syntax if you want to use variable inside CSS words:
@@@_
Usage
See PostCSS docs for examples for your environment.
Options
Call plugin function to set options:
variables
Set default variables. It is useful to store colors or other constants in common file:
// config/colors.js moduleexports = blue: '#056ef0' // gulpfile.js var colors = ;var vars = gulp;
You can set a function returning object, if you want to update default variables in webpack hot reload:
only
Set value only for variables from this object. Other variables will not be changed. It is useful for PostCSS plugin developers.