Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts: Add PostCSS (.pcss extension) file support to wp-scripts #45352

Merged

Conversation

dpellenwood
Copy link
Contributor

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 .pcss file 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.

@codesandbox
Copy link

codesandbox bot commented Oct 27, 2022

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Oct 27, 2022
@github-actions
Copy link

👋 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.

@skorasaurus skorasaurus added the [Tool] WP Scripts /packages/scripts label Nov 20, 2022
@gziolo gziolo changed the title Add PostCSS (.pcss extension) file support to wp-scripts Scripts: Add PostCSS (.pcss extension) file support to wp-scripts Feb 2, 2023
@gziolo gziolo added the [Type] Enhancement A suggestion for improvement. label Feb 2, 2023
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@gziolo gziolo merged commit 05bea6d into WordPress:trunk Feb 2, 2023
@github-actions
Copy link

github-actions bot commented Feb 2, 2023

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:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 15.2 milestone Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Tool] WP Scripts /packages/scripts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants