Skip to content

Commit

Permalink
Fix @import url() being stripped (#16144)
Browse files Browse the repository at this point in the history
  • Loading branch information
wongjn authored Feb 1, 2025
1 parent 50bafce commit b7436f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Nothing yet!
### Fixed

- Fix `@import url()` being stripped ([#16144](https://github.com/tailwindlabs/tailwindcss/pull/16144))

## [4.0.2] - 2025-01-31

Expand Down
3 changes: 3 additions & 0 deletions packages/tailwindcss/src/ast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ it('should not emit empty rules once optimized', () => {
@layer foo, bar, baz;
@custom-media --modern (color), (hover);
@namespace 'http://www.w3.org/1999/xhtml';
@import url('https://fonts.googleapis.com/css2?family=Cedarville+Cursive&display=swap');
`)

expect(toCss(ast)).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -174,6 +175,7 @@ it('should not emit empty rules once optimized', () => {
@layer foo, bar, baz;
@custom-media --modern (color), (hover);
@namespace 'http://www.w3.org/1999/xhtml';
@import url('https://fonts.googleapis.com/css2?family=Cedarville+Cursive&display=swap');
"
`)

Expand All @@ -182,6 +184,7 @@ it('should not emit empty rules once optimized', () => {
@layer foo, bar, baz;
@custom-media --modern (color), (hover);
@namespace 'http://www.w3.org/1999/xhtml';
@import url('https://fonts.googleapis.com/css2?family=Cedarville+Cursive&display=swap');
"
`)
})
3 changes: 2 additions & 1 deletion packages/tailwindcss/src/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ export function optimizeAst(ast: AstNode[]) {
copy.name === '@layer' ||
copy.name === '@charset' ||
copy.name === '@custom-media' ||
copy.name === '@namespace'
copy.name === '@namespace' ||
copy.name === '@import'
) {
parent.push(copy)
}
Expand Down

0 comments on commit b7436f8

Please # to comment.