CSS in this project is injected by js via vite-plugin-css-injected-by-js, and thus it cannot be post-processed by PostCSS or lightningCSS on the user end.
For example, this project injects prefixes that may not be needed by users targeting the latest browsers. If the styles can be post-processed on the user end, those unnecessary styles will be removed by PostCSS to reduce bundle size.
On the other hand, this project uses some features that are not supported on old browsers like inset and percentage in opacity, both of which have a global usage of less than 95% https://caniuse.com/mdn-css_properties_inset. The users that target older browsers will need PostCSS to transpile them.
As a library, I think it would be better to build styles into a .css dist file instead of a js string.
CSS in this project is injected by js via vite-plugin-css-injected-by-js, and thus it cannot be post-processed by PostCSS or lightningCSS on the user end.
For example, this project injects prefixes that may not be needed by users targeting the latest browsers. If the styles can be post-processed on the user end, those unnecessary styles will be removed by PostCSS to reduce bundle size.
On the other hand, this project uses some features that are not supported on old browsers like
inset
andpercentage in opacity
, both of which have a global usage of less than 95% https://caniuse.com/mdn-css_properties_inset. The users that target older browsers will need PostCSS to transpile them.As a library, I think it would be better to build styles into a
.css
dist file instead of a js string.