Scripts: Add PostCSS (.pcss extension) file support to wp-scripts#45352
Scripts: Add PostCSS (.pcss extension) file support to wp-scripts#45352gziolo merged 9 commits intoWordPress:trunkfrom
Conversation
…ssLoaders config.
…llow inlining SVGs from PostCSS files.
|
|
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @dpellenwood! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
gziolo
left a comment
There was a problem hiding this comment.
@dpellenwood, thank you for sending this pull request. I don't have experience with .pcss extension but if everything can be acomplished by allowing a new extension for styles then I'm happy to land it.
This change should get published to npm in about two weeks as it's tied to the Gutenberg plugin release cycle (we had a release yesterday). I'd be great to hear back from you whether this allows removing all custom configurations you mentioned.
|
Congratulations on your first merged pull request, @dpellenwood! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: And if you don't have a WordPress.org account, you can create one on this page: Kudos! |
What?
Adds support for file using the .pcss file extension to be linted and processed by wp-scripts.
Wp-scripts already supports the necessary loaders for processing pcss files using the same rules as standard css files. This PR simply allows the
.pcssfile extension to be included for linting and processing. It doesn't modify any of the existing linting or processing rules.Why?
We're relying on wp-scripts to handle build tooling for a number of projects. However, we prefer to use PostCSS (pcss files) to stay as close to browser-standard CSS as possible while still utilizing a small collection of plugins for features which aren't yet supported in browser (nesting, for example). Adding support for the pcss file extensions allows us and other 3rd-party developers to implement their own PostCSS plugins, configs, and linting rules as they choose without conflicting or modifying the existing Gutenberg configuration and preference for Sass/scss.
For context, I've implemented this functionality as an customized webpack.config.js for our own internal use, but it requires a lot of overhead code to accomplish due to the definition of cssLoaders existing as a private const which requires us to either use a different loader config or duplicate the existing config externally.