Skip to content

Commit

Permalink
fix(bundler): allow CSS nesting by default, restore postcss-preset-env (
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber authored Nov 15, 2024
1 parent 2b8ddb9 commit 33a35a4
Show file tree
Hide file tree
Showing 4 changed files with 650 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus-bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"@docusaurus/logger": "3.6.1",
"@docusaurus/types": "3.6.1",
"@docusaurus/utils": "3.6.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.2.1",
"clean-css": "^5.3.2",
"copy-webpack-plugin": "^11.0.0",
Expand All @@ -37,6 +36,7 @@
"null-loader": "^4.0.1",
"postcss": "^8.4.26",
"postcss-loader": "^7.3.3",
"postcss-preset-env": "^10.1.0",
"react-dev-utils": "^12.0.1",
"terser-webpack-plugin": "^5.3.9",
"tslib": "^2.6.0",
Expand Down
9 changes: 7 additions & 2 deletions packages/docusaurus-bundler/src/loaders/styleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,13 @@ export async function createStyleLoadersFactory({
// https://github.com/facebook/create-react-app/issues/2677
ident: 'postcss',
plugins: [
// eslint-disable-next-line global-require
require('autoprefixer'),
[
require.resolve('postcss-preset-env'),
{
// Keeping this empty options object on purpose
// It could be more convenient for configurePostCss() usage
},
],
],
},
},
Expand Down
40 changes: 25 additions & 15 deletions website/_dogfooding/dogfooding.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,36 @@
* LICENSE file in the root directory of this source tree.
*/

html.plugin-docs.plugin-id-docs-tests .red > a {
color: red;
}
html {
@media screen and (min-width: 1px) {
&.plugin-docs.plugin-id-docs-tests {
.red > a {
color: red;
}

html.plugin-docs.plugin-id-docs-tests .navbar {
border-bottom: solid thin cyan;
}
.navbar {
border-bottom: solid thin cyan;
}
}

html.plugin-blog.plugin-id-blog-tests .navbar {
border-bottom: solid thin lime;
}
&.plugin-blog.plugin-id-blog-tests {
.navbar {
border-bottom: solid thin lime;
}
}

html.plugin-pages.plugin-id-pages-tests .navbar {
border-bottom: solid thin yellow;
&.plugin-pages.plugin-id-pages-tests {
.navbar {
border-bottom: solid thin yellow;
}
}

&:has(#navbar-dropdown-tests) .navbar__item.dropdown ~ a {
display: none;
}
}
}

#z-index-test {
z-index: 100;
}

html:has(#navbar-dropdown-tests) .navbar__item.dropdown ~ a {
display: none;
}
Loading

0 comments on commit 33a35a4

Please sign in to comment.