Skip to content

Conversation

@RobinMalfait
Copy link
Member

During the migration process, a lot of changes to the CSS file happen. Some parts are converted, some parts are deleted and some new CSS is added.

To make sure we are generating a sensible and good looking CSS file, we will sort the final CSS and pretty print it.

The order we came up with looks like this:

/* Imports */
@import "tailwindcss";
@import "../other.css";

/* Configuration */
@config "../path/to/tailwindcss.config.js";

@plugin "my-plugin-1";
@plugin "my-plugin-2";

@source "./foo/**/*.ts";
@source "./bar/**/*.ts";

@variant foo {}
@variant bar {}

@theme {}

/* Border compatibility CSS */
@layer base {}

/* Utilities */
@utility foo {}
@utility bar {}

/* Rest of your own CSS if any */

@RobinMalfait RobinMalfait force-pushed the feat/sort-generated-css branch from f411162 to e3efbcd Compare November 4, 2024 13:31
@RobinMalfait RobinMalfait force-pushed the feat/multi-root-migrations branch from 8c55be9 to d838c9c Compare November 4, 2024 16:25
@RobinMalfait RobinMalfait force-pushed the feat/sort-generated-css branch from e3efbcd to 6d77c8a Compare November 4, 2024 16:28
Base automatically changed from feat/multi-root-migrations to next November 4, 2024 16:52
@RobinMalfait RobinMalfait force-pushed the feat/sort-generated-css branch 2 times, most recently from d4fac30 to bff5638 Compare November 5, 2024 00:07
@RobinMalfait RobinMalfait marked this pull request as ready for review November 5, 2024 09:55
@RobinMalfait RobinMalfait requested a review from a team as a code owner November 5, 2024 09:55
@RobinMalfait RobinMalfait force-pushed the feat/sort-generated-css branch 4 times, most recently from 45df765 to a2a9412 Compare November 6, 2024 11:40
@RobinMalfait RobinMalfait force-pushed the feat/sort-generated-css branch from a0fa160 to f8ce5da Compare November 6, 2024 15:53
Copy link
Member

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's gooo it's so good to read the diff of the integration test snapshots haha. Some comments inline, mostly not sure about the change log thing 🤔

CHANGELOG.md Outdated
- Ensure adjacent rules are merged together after handling nesting when generating optimized CSS ([#14873](https://github.com/tailwindlabs/tailwindcss/pull/14873))
- _Upgrade (experimental)_: Install `@tailwindcss/postcss` next to `tailwindcss` ([#14830](https://github.com/tailwindlabs/tailwindcss/pull/14830))
- _Upgrade (experimental)_: Remove whitespace around `,` separator when print arbitrary values ([#14838](https://github.com/tailwindlabs/tailwindcss/pull/14838))
- _Upgrade (experimental)_: Sort upgraded CSS ([#14866](https://github.com/tailwindlabs/tailwindcss/pull/14866))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current message makes it sound like the order was wrong or something but the change is only really for esthetic reasons, what do you think about this? I tried to not use the word order since it has an inherent meaning in CSS and am trying to lean on the "restructure" terminology

Suggested change
- _Upgrade (experimental)_: Sort upgraded CSS ([#14866](https://github.com/tailwindlabs/tailwindcss/pull/14866))
- _Upgrade (experimental)_: Restructure the generated CSS to make it easier to read ([#14866](https://github.com/tailwindlabs/tailwindcss/pull/14866))

Also this doesn't really fix anything so maybe it shouldn't be in the fixed category either I think 🤔

I am still not convinced this is a very good message, maybe maybe this just doesn't need a changelog entry at all haha

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah hmm, maybe this is just an internal refactor. Especially because the codemods are not idempotent right now meaning you only will be able to run them once anyway. So it's still a single 'upgrade' and not a fix to previous upgrades from the user's perspective.

@RobinMalfait RobinMalfait force-pushed the feat/sort-generated-css branch from f8b30f5 to 50e4840 Compare November 7, 2024 11:59
@RobinMalfait RobinMalfait enabled auto-merge (squash) November 7, 2024 12:01
@RobinMalfait RobinMalfait merged commit 462308d into next Nov 7, 2024
1 check passed
@RobinMalfait RobinMalfait deleted the feat/sort-generated-css branch November 7, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants