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

Add support for local keyframes through a PostCSS plugin. #62476

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions bin/packages/build-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ async function buildCSS( file ) {
data: ''.concat( '@use "sass:math";', importLists, contents ),
} );

const result = await postcss(
require( '@wordpress/postcss-plugins-preset' )
).process( builtSass.css, {
const result = await postcss( [
require( 'postcss-local-keyframes' ),
...require( '@wordpress/postcss-plugins-preset' ),
] ).process( builtSass.css, {
from: 'src/app.css',
to: 'dest/app.css',
} );
Expand Down
19 changes: 18 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Member

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?

},
"devDependencies": {
"@actions/core": "1.9.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/edit-site/src/components/sidebar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
overflow-y: auto;
}

@keyframes slide-from-right {
@keyframes local--slide-from-right {
from {
transform: translateX(50px);
opacity: 0;
Expand All @@ -14,7 +14,7 @@
}
}

@keyframes slide-from-left {
@keyframes local--slide-from-left {
from {
transform: translateX(-50px);
opacity: 0;
Expand Down Expand Up @@ -47,11 +47,11 @@
}

&.slide-from-left {
animation-name: slide-from-left;
animation-name: local--slide-from-left;
}

&.slide-from-right {
animation-name: slide-from-right;
animation-name: local--slide-from-right;
}

}
Loading