fix: styles import order#2512
Merged
Merged
Conversation
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restructures how Slidev client styles are imported to preserve a deterministic CSS order, addressing regressions caused by import.meta.glob hoisting.
Changes:
- Replaces the previous
/@slidev/stylesvirtual module with a dedicated client entry atpackages/client/styles/index.ts. - Introduces a new virtual module (
#slidev/conditional-styles) to load user/theme style globs (and other conditional CSS). - Updates the client bootstrap to import the new centralized styles entry.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/types/client.d.ts | Renames the side-effect-only virtual module typing to #slidev/conditional-styles. |
| packages/slidev/node/virtual/styles.ts | Removes the old virtual module that generated the full style import chain. |
| packages/slidev/node/virtual/index.ts | Registers the new conditional-styles virtual template. |
| packages/slidev/node/virtual/conditional-styles.ts | Adds a new virtual module responsible for import.meta.glob-driven style loading (and feature conditionals). |
| packages/client/styles/index.ts | New central “style entry” defining the desired CSS import order and delegating conditional imports to the virtual module. |
| packages/client/setup/main.ts | Switches from #slidev/styles to importing the new client styles entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #2495. closes #2511.
import.meta.glob-imported styles are always moved to the top of the file; that's why fix: import order with import.meta.glob #2457 was proposed.@unocss/reset/tailwind.cssanduno:*.csswas still wrong.packages/client/styles/index.ts, and conditional (import.meta.glob) styles are loaded in#slidev/conditional-styles.import 'uno.css'was the last one to import (before the related PRs)? This behavior is kept in this PR.