Skip to content

Commit 1f23c2e

Browse files
Bump to latest cssnano v6 (#14105)
We bundle cssnano in our CLI and it's on an older version that does not handle nested CSS correctly. This PR updates it to the latest version of v6.x Fixes #14092
1 parent 28bd90e commit 1f23c2e

File tree

5 files changed

+479
-404
lines changed

5 files changed

+479
-404
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
- Fix minification when using nested CSS ([#14105](https://github.com/tailwindlabs/tailwindcss/pull/14105))
1111

1212
## [3.4.7] - 2024-07-25
1313

integrations/tailwindcss-cli/tests/cli.test.js

+39
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,45 @@ describe('Build command', () => {
9696
expect(withoutMinify.length).toBeGreaterThan(withMinify.length)
9797
})
9898

99+
test('--minify does not break nested CSS', async () => {
100+
await writeInputFile('index.html', html`<div class="font-bold"></div>`)
101+
await writeInputFile(
102+
'input.css',
103+
css`
104+
.parent {
105+
& .child {
106+
color: red;
107+
}
108+
& .child {
109+
&:not([href]) {
110+
color: green;
111+
}
112+
}
113+
}
114+
`
115+
)
116+
117+
await $(`${EXECUTABLE} --input ./src/input.css --output ./dist/main.css --minify`)
118+
let withMinify = await readOutputFile('main.css')
119+
120+
// Verify that we got the expected output. Note: `.toIncludeCss` formats
121+
// `actual` & `expected`
122+
expect(withMinify).toIncludeCss(
123+
css`
124+
.parent {
125+
& .child {
126+
color: red;
127+
}
128+
& .child {
129+
&:not([href]) {
130+
color: green;
131+
}
132+
}
133+
}
134+
`
135+
)
136+
})
137+
99138
test('--no-autoprefixer', async () => {
100139
await writeInputFile('index.html', html`<div class="select-none"></div>`)
101140

0 commit comments

Comments
 (0)