postcss-custom-properties-fallback

Adds fallbacks to your CSS var() functions

MIT License

Downloads
15.4K
Stars
2
Committers
4
postcss-custom-properties-fallback - v1.0.2 Latest Release

Published by stipsan over 2 years ago

Fixes list value handling

Given:

:root {
  --shadow-depth-1: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --color-rgb: 45, 45, 45;
}

.test {
  box-shadow: var(--shadow-depth-1);
  color: rbga(var(--color-rgb), 0.5);
}

We used to output (incorrectly):

.test {
  box-shadow: var(--uui-shadow-depth-5,0,19px,38px,rgba(0,0,0,0.30),,,0,15px,12px,rgba(0,0,0,0.22));
  color: rbga(var(--color-rgb,45,,,45,,,45), 0.5);
}

Now it outputs:

.test {
  box-shadow: var(
    --shadow-depth-1,
    0 1px 3px rgba(0, 0, 0, 0.12),
    0 1px 2px rgba(0, 0, 0, 0.24)
  );
  color: rbga(var(--color-rgb, 45, 45, 45), 0.5);
}

Thanks to @julczka for the fix!! 🎉 🙇

postcss-custom-properties-fallback - v1.0.0

Published by stipsan almost 4 years ago

Support for importing from CSS files in importFrom will come in the next version.

Package Rankings
Top 5.06% on Npmjs.org