From 0b65e24b355793fb860bf59308ac4d6127439423 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Mon, 2 Dec 2024 18:09:20 +0100 Subject: [PATCH] Vite: Don't rebase absolute `url()` --- CHANGELOG.md | 4 +++- packages/@tailwindcss-node/src/urls.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14cc77dbfb59..d712fef8fb08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Ensure absolute `url()`s inside imported CSS files are not rebased when using `@tailwindcss/vite` ## [4.0.0-beta.4] - 2024-11-29 diff --git a/packages/@tailwindcss-node/src/urls.ts b/packages/@tailwindcss-node/src/urls.ts index c6009a927105..c4d56deb7e60 100644 --- a/packages/@tailwindcss-node/src/urls.ts +++ b/packages/@tailwindcss-node/src/urls.ts @@ -51,6 +51,8 @@ export async function rewriteUrls({ let promises: Promise[] = [] function replacerForDeclaration(url: string) { + if (url[0] === '/') return url + let absoluteUrl = path.posix.join(normalizePath(base), url) let relativeUrl = path.posix.relative(normalizePath(root), absoluteUrl)