Skip to content

Commit 19de557

Browse files
Ensure changes to the input CSS file result in a full rebuild (#14744)
Fixes #14726 I think we broke this when we changed core so that it can handle `@import "…"` in CSS.
1 parent 18cb3c6 commit 19de557

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616

1717
- Allow spaces spaces around operators in attribute selector variants ([#14703](https://github.com/tailwindlabs/tailwindcss/pull/14703))
1818
- Ensure color opacity modifiers work with OKLCH colors ([#14741](https://github.com/tailwindlabs/tailwindcss/pull/14741))
19+
- Ensure changes to the input CSS file result in a full rebuild ([#14744](https://github.com/tailwindlabs/tailwindcss/pull/14744))
1920
- _Upgrade (experimental)_: Migrate `flex-grow` to `grow` and `flex-shrink` to `shrink` ([#14721](https://github.com/tailwindlabs/tailwindcss/pull/14721))
2021
- _Upgrade (experimental)_: Minify arbitrary values when printing candidates ([#14720](https://github.com/tailwindlabs/tailwindcss/pull/14720))
2122
- _Upgrade (experimental)_: Ensure legacy theme values ending in `1` (like `theme(spacing.1)`) are correctly migrated to custom properties ([#14724](https://github.com/tailwindlabs/tailwindcss/pull/14724))

integrations/cli/index.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,23 @@ describe.each([
210210
}
211211
`,
212212
])
213+
214+
await fs.write(
215+
'project-a/src/index.css',
216+
css`
217+
@import 'tailwindcss/utilities';
218+
@theme {
219+
--color-*: initial;
220+
}
221+
`,
222+
)
223+
224+
await fs.expectFileToContain('project-a/dist/out.css', [
225+
css`
226+
:root {
227+
}
228+
`,
229+
])
213230
},
214231
)
215232

packages/@tailwindcss-cli/src/commands/build/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,12 @@ export async function handle(args: Result<ReturnType<typeof options>>) {
122122
env.DEBUG && console.timeEnd('[@tailwindcss/cli] Write output')
123123
}
124124

125-
let inputBasePath =
126-
args['--input'] && args['--input'] !== '-'
127-
? path.dirname(path.resolve(args['--input']))
128-
: process.cwd()
129-
let fullRebuildPaths: string[] = []
125+
let inputFilePath =
126+
args['--input'] && args['--input'] !== '-' ? path.resolve(args['--input']) : null
127+
128+
let inputBasePath = inputFilePath ? path.dirname(inputFilePath) : process.cwd()
129+
130+
let fullRebuildPaths: string[] = inputFilePath ? [inputFilePath] : []
130131

131132
async function createCompiler(css: string) {
132133
env.DEBUG && console.time('[@tailwindcss/cli] Setup compiler')
@@ -201,7 +202,7 @@ export async function handle(args: Result<ReturnType<typeof options>>) {
201202
@import 'tailwindcss';
202203
`
203204
clearRequireCache(resolvedFullRebuildPaths)
204-
fullRebuildPaths = []
205+
fullRebuildPaths = inputFilePath ? [inputFilePath] : []
205206

206207
// Create a new compiler, given the new `input`
207208
compiler = await createCompiler(input)

0 commit comments

Comments
 (0)