You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closes#2015
- Mention that `corePlugins`, `safelist`, and `seperator` no longer
exist in v4
- Mention `@layer components` in the `@layer utilities` section
Copy file name to clipboardExpand all lines: src/docs/upgrade-guide.mdx
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -595,7 +595,7 @@ The generated CSS variables _will_ include a prefix to avoid conflicts with any
595
595
596
596
### Adding custom utilities
597
597
598
-
In v3, any custom classes you defined within `@layer utilities` would get picked up by Tailwind as a true utility class and would automatically work with variants like `hover`, `focus`, or `lg`.
598
+
In v3, any custom classes you defined within `@layer utilities`or `@layer components`would get picked up by Tailwind as a true utility class and would automatically work with variants like `hover`, `focus`, or `lg` with the difference being that `@layer components` would always come first in the generated stylesheet.
599
599
600
600
In v4 we are using native cascade layers and no longer hijacking the `@layer` at-rule, so we've introduced the `@utility` API as a replacement:
601
601
@@ -613,6 +613,26 @@ In v4 we are using native cascade layers and no longer hijacking the `@layer` at
613
613
}
614
614
```
615
615
616
+
Custom utilities are now also sorted based on the amount of properties they define. This means that component utilities like this `.btn` can be overwritten by other Tailwind utilities without additional configuration:
617
+
618
+
```css
619
+
/* [!code filename:CSS] */
620
+
/* [!code --:8] */
621
+
@layer components {
622
+
.btn {
623
+
border-radius: 0.5rem;
624
+
padding: 0.5rem1rem;
625
+
background-color: ButtonFace;
626
+
}
627
+
}
628
+
/* [!code ++:6] */
629
+
@utility btn {
630
+
border-radius: 0.5rem;
631
+
padding: 0.5rem 1rem;
632
+
background-color: ButtonFace;
633
+
}
634
+
```
635
+
616
636
Learn more about registering custom utilities in the [adding custom utilities documentation](/docs/adding-custom-styles#adding-custom-utilities).
617
637
618
638
### Variant stacking order
@@ -725,6 +745,8 @@ If you still need to use a JavaScript config file, you can load it explicitly us
725
745
@config "../../tailwind.config.js";
726
746
```
727
747
748
+
The `corePlugins`, `safelist`, and `separator` options from the JavaScript-based config are not supported in v4.0.
749
+
728
750
### Theme values in JavaScript
729
751
730
752
In v3 we exported a `resolveConfig` function that you could use to turn your JavaScript-based config into a flat object that you could use in your other JavaScript.
0 commit comments