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
Copy file name to clipboardExpand all lines: README.md
+9-4Lines changed: 9 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,13 @@ If a local configuration file cannot be found the plugin will fallback to the de
70
70
71
71
By default this plugin sorts classes in the `class` attribute, any framework-specific equivalents like `className`, `:class`, `[ngClass]`, and any Tailwind `@apply` directives.
72
72
73
-
You can sort additional attributes using the `tailwindAttributes` option, which takes an array of attribute names:
73
+
You can extend this behavior to sort classes in any attribute using the following options:
74
+
75
+
-`tailwindAttributes`: An array of exact attribute names to sort.
76
+
-`tailwindAttributesStartsWith`: An array of prefixes to match attributes that begin with a certain string.
77
+
-`tailwindAttributesEndsWith`: An array of suffixes to match attributes that end with a certain string.
78
+
79
+
#### Example 1
74
80
75
81
```json5
76
82
// .prettierrc
@@ -91,17 +97,16 @@ function MyButton({ children }) {
91
97
}
92
98
```
93
99
94
-
#### Matching attributes with a prefix or suffix
100
+
#### Example 2
95
101
96
102
```json5
97
103
// .prettierrc
98
104
{
99
-
"tailwindAttributesStartsWith": ["data"],
100
105
"tailwindAttributesEndsWith": ["ClassName"]
101
106
}
102
107
```
103
108
104
-
With this configuration, attributes like `data-active-classes` and `buttonClassName` will be sorted:
109
+
With this configuration, any class found with suffix `ClassName` will be sorted:
0 commit comments