diff --git a/CHANGELOG.md b/CHANGELOG.md index 9126b72f7963..bbe07291ca89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - PostCSS: Ensure that errors in stylesheet dependencies are recoverable ([#17754](https://github.com/tailwindlabs/tailwindcss/pull/17754)) - Upgrade: Correctly print variants starting with `@` ([#17814](https://github.com/tailwindlabs/tailwindcss/pull/17814)) - Skip `color-mix(…)` when opacity is `100%` ([#17815](https://github.com/tailwindlabs/tailwindcss/pull/17815)) +- Upgrade: Don't format stylesheets when nothing changed ([#17824](https://github.com/tailwindlabs/tailwindcss/pull/17824)) ## [4.1.4] - 2025-04-14 diff --git a/integrations/upgrade/index.test.ts b/integrations/upgrade/index.test.ts index b52031b3275c..264bd7ff4c3c 100644 --- a/integrations/upgrade/index.test.ts +++ b/integrations/upgrade/index.test.ts @@ -1266,7 +1266,6 @@ test( --- ./src/c.1.css --- @import './c.2.css' layer(utilities); - .baz-from-c { color: green; } diff --git a/packages/@tailwindcss-upgrade/src/index.ts b/packages/@tailwindcss-upgrade/src/index.ts index 85b5520a05ee..ed802a2e04d4 100644 --- a/packages/@tailwindcss-upgrade/src/index.ts +++ b/packages/@tailwindcss-upgrade/src/index.ts @@ -90,6 +90,7 @@ async function run() { let stylesheets = loadResults .filter((result) => result.status === 'fulfilled') .map((result) => result.value) + let originals = new Map(stylesheets.map((sheet) => [sheet, sheet.root.toString()])) // Analyze the stylesheets try { @@ -213,6 +214,7 @@ async function run() { // Format nodes for (let sheet of stylesheets) { + if (originals.get(sheet) === sheet.root.toString()) continue await postcss([sortBuckets(), formatNodes()]).process(sheet.root!, { from: sheet.file! }) }