References to missing CSS variables should fail the build
hojberg opened this issue · 3 comments
Anytime we reference a variable that does not exist (could be due to a typo or an old, since deprecated variable) we should fail the build.
This should fail both in ui-core and in the consuming applications.
Attempted this with postcss-css-variables without luck. It doesn't play well with how we consume ui-core and the custom module resolution we use for it.
Notably postcss-css-variables
doesn't work with "global" css variables defined on :root
, you'd have to import the variable module into each css file that needs it. This can sorta be dealt with by running postcss-import
before postcss-css-variables
, but this then has issues with the way we resolve ui-core.
An alternative route could to "lint" in a completely separate mechanism.
There's also things like this https://www.npmjs.com/package/@sonatype/undefined-css-variable-checker that run on a URL.
Added a small scrip that fails the build if missing css variables are used.