Skip to content

Commit

Permalink
chore(frontend): bump tailwindcss to v4 (#4665)
Browse files Browse the repository at this point in the history
# Motivation

We want to bump `tailwindcss` to v4. However [the migration tool does
not support SASS
files](tailwindlabs/tailwindcss#15716).

# Workaround

We changed all the `.scss` files to a copy in `.css` and use the
migration tool, and then reverted. Same thing with the language in the
`<style>` tag of Svelte components.
Then we added a few manual tweaks anyway.

# Disclaimer

Since a part of the PR was a manual process, it may very well be that I
missed something or there is some error in migration.

# Note

Apparently `prettier-plugin-tailwindcss` was bumped too, so a few
changes happened in the sorting order of the tailwind classes too. That
is the reason for this many files changed in this PR, since we have an
auto-formatter.

Furthermore, it seems that [a few classes will require a Vite update to
work properly](vitejs/vite#18974). For example
`space-x-*` and `space-y-*`.

# Changes

- The migration tool:
  - installed `tailwindcss` v4;
  - changed `postcss.config`;
- migrated the tailwind classes that required migration (see [upgrade
guide](https://tailwindcss.com/docs/upgrade-guide));
- correctly changed `global.css` (that we reverted to `global.scss`
after).

- A few changes were missing, and we did it manually:
- The `Hero` gradient does not need a `via-` color anymore, it can
changed to `from-`.
- The util `@screen foo` is deprecated and should be replaced with
`@media (width >= theme(--breakpoint-foo))` (see [codebase of
tailwindcss
migration](https://github.com/tailwindlabs/tailwindcss/blob/121cf6bd807a35ad9814dd5444eeb3594601fff8/packages/%40tailwindcss-upgrade/src/codemods/migrate-media-screen.test.ts)).
- It is
[suggested](https://tailwindcss.com/docs/upgrade-guide#using-vite) to
install and add `@tailwindcss/vite` in `vite` (and `vitest`) configs;
- Move `@include meta.load-css(...)` inside `@layer base {...}`
(suggestion in [tailwindcss
discussion](tailwindlabs/tailwindcss#16421)).

- We create another branch to make the changes manually following the
[upgrade guide](https://tailwindcss.com/docs/upgrade-guide) and they
matched:
  - #4666

# Tests

There is not much test to help us, apart update the E2E snapshots and
manual navigation in local replica:



https://github.com/user-attachments/assets/d0ae2e36-7fff-4ff8-8829-3c93e900650a

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
AntonioVentilii and github-actions[bot] authored Feb 12, 2025
1 parent 85b6e46 commit 97fae91
Show file tree
Hide file tree
Showing 201 changed files with 878 additions and 841 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"prettier-plugin-organize-imports",
"prettier-plugin-tailwindcss"
],
"tailwindStylesheet": "./src/frontend/src/lib/styles/global.scss",
"parser": "svelte",
"htmlWhitespaceSensitivity": "strict"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 97fae91

Please sign in to comment.