Skip to content

Commit 9843291

Browse files
authored
Improve Migration steps for TW apply (#3589)
1 parent 5ede883 commit 9843291

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

sites/skeleton.dev/src/content/docs/get-started/migrate-from-v2.mdx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ Migrate to the latest release of SvelteKit v2.
6161

6262
### Tailwind v4
6363

64-
Before migration to tailwind V4 using their upgrade guide some manual steps are required:
64+
Before migration to tailwind v4 using their upgrade guide some manual steps are required:
6565

6666
1. Remove the `skeleton` plugin from your `tailwind.config` file.
6767
2. Rename your `app.postcss` or `app.pcss` to `app.css`.
6868
3. Remove the `purgecss` (`vite-plugin-tailwind-purgecss`) vite plugin from your `vite.config` (if installed).
6969

7070
Migrate to the latest release of Tailwind v4.
7171

72+
> TIP: Having trouble running Tailwind's automated migration script due to `@apply`? Remove the classes temporarily, then follow [these steps](/docs/get-started/migrate-from-v2#replacing-apply) to adapt to native CSS custom properties and Tailwind's new utilities.
73+
7274
<figure class="linker bg-noise">
7375
<a class="btn preset-filled" href="https://tailwindcss.com/docs/upgrade-guide" target="_blank">
7476
Tailwind v4 Migration &rarr;
@@ -214,6 +216,35 @@ Taliwind v4 represents a major update for Tailwind. We've detailed the most nota
214216
- The Skeleton `data-theme` attribute has moved from `<body>` to `<html>`
215217
- Themes colors are now stored in the [oklch format](https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl), but optionally support any format.
216218

219+
### Replacing @apply
220+
221+
We strongly encourage you take this opportunity to move away from any usage of `@apply`. Tailwind has long since advocated against heavy use of this, and Tailwind v4 introduces new directives and functions that make this much easier to avoid. Here's a trivial example:
222+
223+
```css
224+
/* Before */
225+
226+
.foo {
227+
@apply bg-surface-50-950 text-surface-950 dark:text-surface-50 p-4;
228+
}
229+
```
230+
231+
```css
232+
/* After */
233+
234+
.foo {
235+
background-color: var(--color-surface-50-950);
236+
color: var(--color-surface-950);
237+
padding: --spacing(4);
238+
@variant dark {
239+
color: var(--color-surface-50);
240+
}
241+
}
242+
```
243+
244+
- Usage of `@apply` may be found in your global stylesheet or component `<style>` blocks.
245+
- Refer to the Skeleton [Core API](/docs/get-started/core-api) documentation for a full list of Skeleton's CSS custom properties.
246+
- Refer to the Tailwind's [functions and directives](https://tailwindcss.com/docs/functions-and-directives) for information on how to utilize these new features.
247+
217248
### Replace Unsupported Features
218249

219250
Skeleton v3 represents a point of reflection on what features should remain as part of the core experience. As such, we've identified a number of features that fall outside of this scope. Don't fret though, we've gone out of our way to detail each feature and provide the best alternative available.

0 commit comments

Comments
 (0)