-
-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Hello csstools team,
First of thanks for your amazing work!
I struggled a bit to configure postcss correctly to enable a plugin that requires a polyfill. In the following my train of thought in the sequence it happened to me while trying to make that feature work.
- In the README.md of the postcss-preset-env pack under
enableClientSidePolyfillsit is written that:
- This only controls if the PostCSS plugins are enabled. It does not cause the browsers libraries to be included in your bundle.
- At the same time it is said that:
- Note that manually enabling/disabling features via the "feature" option overrides this flag.
- Now under "Plugins that need client library
" there is a list of all the libraries with each a link to the plugin and the polyfill.
For my project I only need the focus-within-pseudo-class feature.
- Checking now the documentation of that plugin it is written:
PostCSS Focus Within works in all major browsers, including Safari 6+ and Internet Explorer 9+ without any additional polyfills.
… which really confused me because:
Isn't the example given there a way to add a polyfill?
- Then again in the documentation of "Plugins that need client library
" it is also written that:
If you want to disable these types of features, please check the enableClientSidePolyfills option.
(I later realised that this should probably be changed to something like If you want to enable all of these types of features [?])
I ended up with something that seems to be working by manually enabling the feature I wanted and manually importing the polyfill like this:
import focusWithin from 'focus-within'
focusWithin(document)I'm still unsure if this is the correct way.
For me my own solution is fine I only want to spare the next person to go through all of this again :)
Basically it seems that there is a missing documentation of how to integrate the plugins that when you use the postcss-preset-env pack.