-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Styling discrepancies between dev and build #4098
Comments
Not sure but it's happening on vitepress 1.0.0 too, at least on stackblitz. |
Most likely caused by this - vitejs/vite#16588 (the order is wrong now - https://www.diffchecker.com/0EPXuHIs/) Working fine till vite 5.3.0-beta.1 Please use npm/pnpm overrides till this is resolved. |
same problem, and pages built using GitHub Actions is normal. |
As @brc-dd mentioned, it is working fine till vite 5.3.0-beta.1, so you have to downgrade vite to that version by specifying an override in the "overrides": {
"vitepress": {
"vite": "5.3.0-beta.1"
}
}, Or like this (for "pnpm": {
"overrides": {
"vite": "5.3.0-beta.1"
}
} |
I will try, thank you
|
Did this work for you? I am seeing this issue between dev preview and build preview and pinning vite to 5.3.0-beta.1 didn't work for me. I am using the latest version of vitepress 1.3.2. I have this in my "overrides": {
"vite": "5.3.0-beta.1"
} |
@ZackBz according to the bun docs, your solution should work. The one I proposed specifying that the override is for |
@ZackBz , it worked, but i am using npm |
Odd, I have added the override to my package.json. I ran |
I also experienced the issue and could narrow it down to the redefined style definitions in index.md, which are done the same way as the style definition in the theme (src/client/theme-default/styles/vars.css), therefore the last defined one in the created style file takes precedence. You can work around it if you don't do the styling in the markdown files but put the override of the theme styling in your custom.css (where you override the default theme). Yet I'am curious if this is not a bug in vite now, because you cannot override with style definitions in the markdown files now anymore, except if this is only related to some names used for the files and the order can be influenced... |
This problem is caused by CSS order, so :root {
--vp-home-hero-name-color: transparent !important;
--vp-home-hero-name-background: -webkit-linear-gradient(315deg, #42d392 25%, #647eff) !important;
--vp-home-hero-image-background-image: linear-gradient(0deg, #42d39280 50%, #34485e80) !important;
--vp-home-hero-image-filter: blur(40px) !important;
}
@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px) !important;
}
}
@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(72px) !important;
}
} |
Describe the bug
Just like the Vite docs, I use custom styles in the
index.md
file using<style module>
. I also use custom components in which I use<style scoped>
.Since I updated from version
1.0.0
to the latest one (the one in the StackBlitz), the built page's styles are broken. In the dev preview everything looks like expected.Reproduction
Open the StackBlitz Demo with this link.
If it does not run automatically, run
npm install && npm run dev
. It should look something like this:Then run
npm run docs:build && npm run docs:preview
and it will look like this:As you can see, the hero image and its background are different and the cards are different as well.
Expected behavior
I expected the built version to look just like the dev preview (or at least very close).
System Info
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: