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

docs: polyfill css :has with postcss plugin #3019

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 10 additions & 2 deletions site/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ const config: Config = {
})
]
};
}
},
configurePostCss(postcssOptions) {
postcssOptions.plugins.push(require('css-has-pseudo'));
return postcssOptions;
},
};
},
[
Expand Down Expand Up @@ -307,7 +311,11 @@ const config: Config = {
*/
playgroundPosition: 'bottom'
}
} as ClassicPresetThemeConfig
} as ClassicPresetThemeConfig,

clientModules: [
'./src/polyfills/css-has.js'
]
};

export default config;
Expand Down
68 changes: 68 additions & 0 deletions site/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 site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@docusaurus/module-type-aliases": "3.0.0",
"@docusaurus/tsconfig": "^3.0.0",
"@types/react": "^18.2.29",
"css-has-pseudo": "^6.0.3",
"micromark-extension-mdxjs": "^3.0.0",
"patch-package": "^8.0.0",
"ts-loader": "^9.5.1",
Expand Down
1 change: 1 addition & 0 deletions site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Layout from '@theme/Layout';
import HomepageFeatures from '@site/src/components/HomepageFeatures';


import styles from './index.module.css';

function HomepageHeader() {
Expand Down
5 changes: 5 additions & 0 deletions site/src/polyfills/css-has.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import ExecutionEnvironment from '@docusaurus/ExecutionEnvironment';

if (ExecutionEnvironment.canUseDOM) {
require('css-has-pseudo/browser').cssHasPseudo(document);
}
Loading