PostCSS plugin to process imported constants from a file, removing them from a global scope.
constants.js
moduleexports = colors: primary: '#8EE7D3' ;
input
~/
output
Within static values
constants.js
moduleexports = borders: weight: '2px' style: 'solid' ;
input
~/
output
@ Rules
constants.js
moduleexports = queries: maxWidth: '200px'
input
~/{
output
{
Usage
You can pass a default set of constants (that can be overriden), if you want to update default constants in webpack hot reload:
Call postcss-local-constants
before any plugins that will compute values stored in constants. See PostCSS docs for examples for your environment.