postcss / postcss-custom-properties

Use Custom Properties in CSS
https://postcss.github.io/postcss-custom-properties
MIT License
597 stars 77 forks source link

`importFrom` should actually import variables (perhaps when `preserve: true`) #219

Open mikestopcontinues opened 4 years ago

mikestopcontinues commented 4 years ago

This follows https://github.com/postcss/postcss-custom-properties/issues/155

I hit the same issue, confused as to why prop: var(--custom); remains after var resolution, but not :root { --custom: val; }. It seems the default functionality should be to include the definitions block, at the very least when preserve: true. That said, I can see how this might break backwards compatibility, so what about an option to import the declarations? The alternative seems incredible dirty—generating a file just to reimport it. In fact, that solution causes infinite refreshes with hot reloading, generating and importing the same file every loop.