Theme: add LightningCSS WPDS token fallback plugin#80401
Conversation
|
Size Change: 0 B Total Size: 7.73 MB |
|
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. |
| @@ -0,0 +1,31 @@ | |||
| import { addFallbackToVar } from '../postcss-plugins/ds-token-fallbacks.mjs'; | |||
There was a problem hiding this comment.
Could be pulled from a shared location.
There was a problem hiding this comment.
Done elsewhere too currently, so better moved in a separate PR.
|
Flaky tests detected in 3d63dec. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/29576112220
|
ciampo
left a comment
There was a problem hiding this comment.
cc @mirka as the OG author of the fallback plugins.,
I gave the PR an initial AI-assisted review pass, but I don't have a lot of experise myself to review this in depth.
Could we get any LightningCSS consumers to test it out (instead of using only synthetic tests) ?
Testing this at Automattic/jetpack#50614 — bundles this produces are identical with alternative PostCSS setup 🎉 |
982fc8c to
d76cae6
Compare
d76cae6 to
a128b92
Compare
Previous plugins added in:
What?
Adds LightningCSS plugin (or "visitor") in the theme package alongside the existing PostCSS, esbuild and Vite plugins.
rawsupport used here). v1.32.0 is the current.Adds tests in all plugins for the "empty fallback" case;
var( --wpds-example, )to ensure we treat it equally in all plugins; no fallback gets injected and it's left empty.Why?
Allows consumers to add WPDS token fallbacks when using LightningCSS without needing to implement workarounds or switch to PostCSS.
One group of consumers are tsdown users, since
@tsdown/cssrelies on lightningcss by default, although the PostCSS processor is available withtsdown, too.How?
Consumers would add the plugin to their configs:
Lightning CSS
tsdown
Testing Instructions
Have a simple LightningCSS and/or tsdown setup with some WPDS tokens without fallbacks. (Should be trivial with AI but let me know if I can help)
Link
@wordpress/themefrom your local GutenbergObserve the built bundle has WPDS fallbacks
Tests:
npm run test:unit -- packages/themeTesting Instructions for Keyboard
Use of AI Tools
yes