Skip to content

Commit

Permalink
Use PostCSS Global Data (#183)
Browse files Browse the repository at this point in the history
this should unblock #149
  • Loading branch information
Luehrsen authored Mar 23, 2023
1 parent 5e64928 commit c0b2dea
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
24 changes: 24 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@csstools/postcss-global-data": "^1.0.3",
"@wordpress/babel-plugin-import-jsx-pragma": "^4.12.0",
"@wordpress/babel-preset-default": "^7.8.0",
"@wordpress/dependency-extraction-webpack-plugin": "^4.12.0",
Expand Down
19 changes: 9 additions & 10 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
module.exports = {
plugins: [
['postcss-import'],
[
'@csstools/postcss-global-data',
{
files: [
'./theme/src/css/vars.css',
'./theme/src/css/vars/_media-queries.css',
],
},
],
[
'postcss-preset-env',
{
stage: 1,
features: {
'custom-media-queries': {
preserve: false,
importFrom: './theme/src/css/vars/_media-queries.css',
},
'custom-properties': {
preserve: true,
importFrom: './theme/src/css/vars.css',
},
},
},
],
['cssnano'],
Expand Down
2 changes: 1 addition & 1 deletion theme/src/css/vars/_media-queries.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* at the moment.
*
* @link: https://drafts.csswg.org/mediaqueries-5/#custom-mq
* @link: https://github.com/postcss/postcss-custom-media
* @link: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-media
**/
@custom-media --xs-query screen and (max-width: 47.9999999em); /** < 768px **/
@custom-media --sm-query screen and (min-width: 48em); /** >= 768px **/
Expand Down

0 comments on commit c0b2dea

Please sign in to comment.