I just moved from SCSS
to PostCSS
with Webpack
and I'm wondering if it's possible to create custom properties dynamically.
A simple example:
/* input */
:root {
@for $i from 1 to 3 {
--layout-flex-$(i): {
flex: $i;
}
}
}
/* output */
:root {
--layout-flex-1: {
flex: 1;
};
--layout-flex-2: {
flex: 2;
};
--layout-flex-3: {
flex: 3;
};
}
I searched for PreCSS
, installed it and it works on simple @for
, but with --properties
I have an error:
Uncaught TypeError: Cannot read property 'call' of undefined at webpack_require (bootstrap 6d4f623…:606) at fn (bootstrap 6d4f623…:130) at Object.256 (index.css?e835:4) at Object. (bootstrap 6d4f623…:23) at webpack_require (bootstrap 6d4f623…:606) at fn (bootstrap 6d4f623…:130) at Object. (index.js:3) at Object. (client.js:2804) at Object.254 (client.js:2805) at webpack_require (bootstrap 6d4f623…:606)
Thanks.