-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix: CSS asset URLs broken with experimental.inlineCss
#85140
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| import localFont from 'next/font/local' | ||
|
|
||
| export const font = localFont({ | ||
| src: './font-noto-sans.woff2', | ||
| variable: '--font-1', | ||
| }) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| p { | ||
| color: yellow; | ||
| } | ||
|
|
||
| body { | ||
| font-family: var(--font-1); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,12 @@ | ||
| import { font } from './font' | ||
|
|
||
| export default function Home() { | ||
| return <p>Home</p> | ||
| return ( | ||
| <div> | ||
| <p>Home</p> | ||
| <p id="with-font" className={font.className}> | ||
| Text with custom font | ||
| </p> | ||
| </div> | ||
| ) | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -173,6 +173,11 @@ impl BrowserChunkingContextBuilder { | |||||
| self | ||||||
| } | ||||||
|
|
||||||
| pub fn inline_css(mut self, inline_css: bool) -> Self { | ||||||
| self.chunking_context.inline_css = inline_css; | ||||||
| self | ||||||
| } | ||||||
|
|
||||||
| pub fn asset_root_path_override(mut self, tag: RcStr, path: FileSystemPath) -> Self { | ||||||
| self.chunking_context.asset_root_paths.insert(tag, path); | ||||||
| self | ||||||
|
|
@@ -278,6 +283,8 @@ pub struct BrowserChunkingContext { | |||||
| export_usage: Option<ResolvedVc<ExportUsageInfo>>, | ||||||
| /// The chunking configs | ||||||
| chunking_configs: Vec<(ResolvedVc<Box<dyn ChunkType>>, ChunkingConfig)>, | ||||||
| /// Whether CSS should be prepared for inlining | ||||||
|
||||||
| inline_css: bool, | ||||||
| } | ||||||
|
|
||||||
| impl BrowserChunkingContext { | ||||||
|
|
@@ -322,6 +329,7 @@ impl BrowserChunkingContext { | |||||
| module_id_strategy: ResolvedVc::upcast(DevModuleIdStrategy::new_resolved()), | ||||||
| export_usage: None, | ||||||
| chunking_configs: Default::default(), | ||||||
| inline_css: false, | ||||||
| }, | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -629,6 +637,11 @@ impl ChunkingContext for BrowserChunkingContext { | |||||
| self.minify_type.cell() | ||||||
| } | ||||||
|
|
||||||
| #[turbo_tasks::function] | ||||||
| fn should_inline_css(&self) -> Vc<bool> { | ||||||
|
||||||
| fn should_inline_css(&self) -> Vc<bool> { | |
| fn should_use_absolute_url_references(&self) -> Vc<bool> { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this