Skip to content

Commit

Permalink
Add support for local keyframes through a PostCSS plugin. (WordPress#…
Browse files Browse the repository at this point in the history
…62476)

Co-authored-by: DaniGuardiola <[email protected]>
Co-authored-by: jsnajdr <[email protected]>
Co-authored-by: tyxla <[email protected]>
Co-authored-by: mirka <[email protected]>
  • Loading branch information
5 people authored and patil-vipul committed Jun 17, 2024
1 parent be3baa1 commit e890935
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
7 changes: 4 additions & 3 deletions bin/packages/build-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,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"
},
"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;
}

}

0 comments on commit e890935

Please sign in to comment.