Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix issue where !container would cause container to have `!import…
…ant` rules
  • Loading branch information
philipp-spiess committed Nov 14, 2024
commit 1df77b570d99f509518e012a2cc0ffbf804ed95d
37 changes: 36 additions & 1 deletion packages/tailwindcss/src/compat/container-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,32 @@ test('combines custom padding and screen overwrites', async () => {
}),
})

expect(compiler.build(['container'])).toMatchInlineSnapshot(`
expect(compiler.build(['container', '!container'])).toMatchInlineSnapshot(`
":root {
--breakpoint-sm: 40rem;
--breakpoint-md: 48rem;
--breakpoint-lg: 64rem;
--breakpoint-xl: 80rem;
--breakpoint-2xl: 96rem;
}
.\\!container {
width: 100% !important;
@media (width >= 40rem) {
max-width: 40rem !important;
}
@media (width >= 48rem) {
max-width: 48rem !important;
}
@media (width >= 64rem) {
max-width: 64rem !important;
}
@media (width >= 80rem) {
max-width: 80rem !important;
}
@media (width >= 96rem) {
max-width: 96rem !important;
}
}
.container {
width: 100%;
@media (width >= 40rem) {
Expand All @@ -331,6 +349,23 @@ test('combines custom padding and screen overwrites', async () => {
max-width: 96rem;
}
}
.\\!container {
margin-inline: auto !important;
padding-inline: 2rem !important;
@media (width >= 40rem) {
max-width: none !important;
}
@media (width >= 64rem) {
max-width: none !important;
}
@media (width >= 80rem) {
max-width: var(--breakpoint-xl) !important;
}
@media (width >= 96rem) {
max-width: var(--breakpoint-2xl) !important;
padding-inline: 4rem !important;
}
}
.container {
margin-inline: auto;
padding-inline: 2rem;
Expand Down
2 changes: 1 addition & 1 deletion packages/tailwindcss/src/compat/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function registerContainerCompat(userConfig: ResolvedConfig, designSystem
return
}

designSystem.utilities.static('container', () => rules)
designSystem.utilities.static('container', () => structuredClone(rules))
}

export function buildCustomContainerUtilityRules(
Expand Down
Loading