-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add support for local keyframes through a PostCSS plugin. #62476
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +27 B (0%) Total Size: 1.76 MB
ℹ️ View Unchanged
|
Flaky tests detected in e79a8c2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9464667362
|
@@ -92,7 +92,8 @@ | |||
"@wordpress/warning": "file:packages/warning", | |||
"@wordpress/widgets": "file:packages/widgets", | |||
"@wordpress/wordcount": "file:packages/wordcount", | |||
"es-module-shims": "^1.8.2" | |||
"es-module-shims": "^1.8.2", | |||
"postcss-local-keyframes": "^0.0.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be in devDependencies
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming that it works. Thanks for working on this plugin.
As a follow up, it might make sense to add a stylelint rule to encourage people to localize their keyframes. Or at least a mention in the Coding Guidelines if not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Are we planning to refactor existing keyframes to local ones as well?
…62476) Co-authored-by: DaniGuardiola <daniguardiola@git.wordpress.org> Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org> Co-authored-by: mirka <0mirka00@git.wordpress.org>
What?
Add the
postcss-local-keyframes
PostCSS plugin (created and maintained by me) to the build pipeline in order to allow keyframe animation names to be local to their stylesheets.Why?
To prevent them from conflicting with other global CSS definitions. See prior attempt here: #61940
How?
Animation names prefixed with
local--
will be prepended with a hash on output. Read the linked plugin README above for full examples and docs. The plugin has been added with default options (global scope by default, notably).Testing Instructions
Run the build script (
npm run build
) and then look for output CSS files. You can search for.edit-site-sidebar__screen-wrapper.slide-from-left
to quickly find the output of the file modified in this PR for testing purposes. The output file in this case ispackages/edit-site/build-style/posts.css
.You should see something like
animation-name: _tpypm_slide-from-left;
(note the hash prefix).Testing Instructions for Keyboard
n/a
Screenshots or screencast
n/a