-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Can't use CSS nesting in prod #9303
Comments
issue solved by changing css to this @media (max-width: 768px) {
.navbar {
width: 100%;
margin-left: 0px;
margin-top: 0px;
}
}
.navbar {
position: sticky;
width: fit-content;
margin-left: 25px;
margin-top: 25px;
height: 48px;
border-radius: 2px;
} |
Will keep it open because it's a bug to me. The new CSS nesting feature allows it, so our PostCSS processing CSS stack should allow it too: https://developer.chrome.com/articles/css-nesting/ CSS nesting is implemented in Chrome so that's probably why it works in dev. It looks like the problem is related to the CSS minimizer, cf the prod warning emitted:
|
You can use To integrate it with Docusaurus 2.x, you can use the instructions below:
When In my humble opinion, Docusaurus should use the |
Thanks, will think about it. We used that preset before, but removed it in #4355 CSS nesting support is not so great atm so it's not a big deal if we don't re-introduce it immediately, notably because you can use the We'll also probably want to explore LightningCSS in the future |
Same issue, pretty confusing as the same code works during development and then breaks in prod even though I have the same I'd have expected it to either flatten it, or keep it. But not just remove it. |
Also reported here: #10113 Sandbox repro: https://stackblitz.com/edit/github-wa8upy?file=src%2Fpages%2Findex.js,src%2Fpages%2Findex.module.css Note:
|
I encountered with an issue maybe related to this, lots of warnings are reported during build. Parts of the log from https://github.com/easyops-cn/brick-docs/actions/runs/10244840918/job/28338673377:
But the build succeeded anyway, the output works on browsers which support css nesting. By the way, the source code of these nesting rules seems to be from a third-party lib monaco-editor. |
It worked in dev but not prod: facebook/docusaurus#9303
Docusaurus facebook/docusaurus#9303 doesn't like some css nesting that monaco editor started using in 0.47.0 For now same as typespec repo we pin to old version of the editor. Seems like however we might be able to build with `USE_SIMPLE_CSS_MINIFIER=true`
Note, Docusaurus v3.6 will come with opt-in support for LightningCSS: https://docusaurus.io/blog/releases/3.6 It should be able to support CSS nesting |
Confirms it works with Docusaurus v3.6 and Docusaurus Faster (using LightningCSS instead of postcss) I plan to fix PostCSS support and restore postcss-preset-env in the next v3.6 patch release: #10680 |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
My custom css for navbar
The media override for smaller screen works well on
yarn start
. but this information got lost after build.I checked the css file in build folder, it does not contain any @media related to max-width:780px either. My guess is those information got lost during build
Reproducible demo
No response
Steps to reproduce
put this in custom.css to override navbar style
Expected behavior
the margin for navbar should be 0 for screen smaller than 780px. however, it's still 25px. And I tried to uss 996px for the width, still doesn't work.
it works as expected under
yarn start
but not onyarn serve
after buildActual behavior
navbar margin is still 25px
Your environment
Self-service
The text was updated successfully, but these errors were encountered: