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

Update handling of css globals & mixins #228

Merged
merged 2 commits into from
Sep 24, 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
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import url("colors.css");
@import url("media-queries.css");
6 changes: 5 additions & 1 deletion mu-plugins/10up-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
"admin": "./assets/js/admin/admin.js",
"frontend": "./assets/js/frontend/frontend.js",
"shared": "./assets/js/shared/shared.js"
}
},
"paths": {
"globalStylesDir": "../../themes/10up-theme/assets/css/globals/",
"globalMixinsDir": "../../themes/10up-theme/assets/css/globals/mixins/"
}
}
}
1 change: 0 additions & 1 deletion themes/10up-theme/assets/css/frontend/global/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import url("reset.css");
@import url("colors.css");
@import url("media-queries.css");
13 changes: 0 additions & 13 deletions themes/10up-theme/assets/css/frontend/global/media-queries.css

This file was deleted.

Empty file.
11 changes: 11 additions & 0 deletions themes/10up-theme/assets/css/globals/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PostCSS Globals

Any individual `.css` files placed in this folder or any nested folder will automatically get loaded by the [@csstools/postcss-global-data](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-global-data) plugin.

This ensures that the definitions defined in these files become available to all CSS entrypoints. So individual block styles, the main stylesheet, etc. all have access to these definitions.

> [!WARNING]
> These CSS files should not produce any output. They are only meant to define global postcss features to become available to all entrypoints
> Also the loading order of these files should not matter at all. They get auto included via a glob expression.

Mixins also get their special treatment. They have a special [`mixins`](../mixins/) folder located next to this `globals` folder
Empty file.
11 changes: 11 additions & 0 deletions themes/10up-theme/assets/css/mixins/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# PostCSS Global Mixins

Any individual `.css` files placed in this folder or any nested folder will automatically get loaded by the [postcss-mixins](https://github.com/postcss/postcss-mixins) plugin.

This ensures that the mixins defined in these files become available to all CSS entrypoints. So individual block styles, the main stylesheet, etc. all have access to these mixins.

> [!WARNING]
> These CSS files should not produce any output. They are only meant to define global postcss features to become available to all entrypoints
> Also the loading order of these files should not matter at all. They get auto included via a glob expression.

Other global definitions such as `@custom-media`, `@custom-selector`, etc. also get their special treatment. They have a special [`globals`](../globals/) folder located next to this `mixins` folder
Loading