Skip to content

Commit d3427d7

Browse files
authored
Merge branch 'main' into fix/vite-html-style-blocks
2 parents 0aca2ce + deb33a9 commit d3427d7

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Refactor gradient implementation to work around [prettier/prettier#17058](https://github.com/prettier/prettier/issues/17058) ([#16072](https://github.com/tailwindlabs/tailwindcss/pull/16072))
1616
- Vite: Ensure hot-reloading works with SolidStart setups ([#16052](https://github.com/tailwindlabs/tailwindcss/pull/16052))
1717
- Vite: Fix a crash when starting the development server in SolidStart setups ([#16052](https://github.com/tailwindlabs/tailwindcss/pull/16052))
18+
- Vite: Don't rebase urls that appear to be aliases ([#16078](https://github.com/tailwindlabs/tailwindcss/pull/16078))
1819
- Vite: Transform `<style>` blocks in HTML files ([#16069](https://github.com/tailwindlabs/tailwindcss/pull/16069))
1920
- Prevent camelCasing CSS custom properties added by JavaScript plugins ([#16103](https://github.com/tailwindlabs/tailwindcss/pull/16103))
2021
- Do not emit `@keyframes` in `@theme reference` ([#16120](https://github.com/tailwindlabs/tailwindcss/pull/16120))

packages/@tailwindcss-node/src/urls.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ test('URLs can be rewritten', async () => {
2424
background: url('/image.jpg');
2525
background: url("/image.jpg");
2626
27+
/* Potentially Vite-aliased URLs: ignored */
28+
background: url(~/image.jpg);
29+
background: url(~/foo/image.jpg);
30+
background: url('~/image.jpg');
31+
background: url("~/image.jpg");
32+
background: url(#/image.jpg);
33+
background: url(#/foo/image.jpg);
34+
background: url('#/image.jpg');
35+
background: url("#/image.jpg");
36+
background: url(@/image.jpg);
37+
background: url(@/foo/image.jpg);
38+
background: url('@/image.jpg');
39+
background: url("@/image.jpg");
40+
2741
/* External URL: ignored */
2842
background: url(http://example.com/image.jpg);
2943
background: url('http://example.com/image.jpg');
@@ -109,6 +123,18 @@ test('URLs can be rewritten', async () => {
109123
background: url(/foo/image.jpg);
110124
background: url('/image.jpg');
111125
background: url("/image.jpg");
126+
background: url(~/image.jpg);
127+
background: url(~/foo/image.jpg);
128+
background: url('~/image.jpg');
129+
background: url("~/image.jpg");
130+
background: url(#/image.jpg);
131+
background: url(#/foo/image.jpg);
132+
background: url('#/image.jpg');
133+
background: url("#/image.jpg");
134+
background: url(@/image.jpg);
135+
background: url(@/foo/image.jpg);
136+
background: url('@/image.jpg');
137+
background: url("@/image.jpg");
112138
background: url(http://example.com/image.jpg);
113139
background: url('http://example.com/image.jpg');
114140
background: url("http://example.com/image.jpg");

packages/@tailwindcss-node/src/urls.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,12 @@ async function doUrlReplace(
149149
return `${funcName}(${wrap}${newUrl}${wrap})`
150150
}
151151

152-
function skipUrlReplacer(rawUrl: string) {
152+
function skipUrlReplacer(rawUrl: string, aliases?: string[]) {
153153
return (
154-
isExternalUrl(rawUrl) || isDataUrl(rawUrl) || rawUrl[0] === '#' || functionCallRE.test(rawUrl)
154+
isExternalUrl(rawUrl) ||
155+
isDataUrl(rawUrl) ||
156+
!rawUrl[0].match(/[\.a-zA-Z0-9_]/) ||
157+
functionCallRE.test(rawUrl)
155158
)
156159
}
157160

0 commit comments

Comments
 (0)