@@ -12,7 +12,8 @@ npm install -D prettier prettier-plugin-tailwindcss
12
12
13
13
Then add the plugin to your [ Prettier configuration] ( https://prettier.io/docs/en/configuration.html ) :
14
14
15
- ``` json
15
+ ``` json5
16
+ // .prettierrc
16
17
{
17
18
" plugins" : [" prettier-plugin-tailwindcss" ]
18
19
}
@@ -32,10 +33,10 @@ By default the plugin will look for this file in the same directory as your Pret
32
33
33
34
Note that paths are resolved relative to the Prettier configuration file.
34
35
35
- ``` js
36
- // prettier.config.js
37
- module . exports = {
38
- tailwindConfig: ' ./styles/tailwind.config.js' ,
36
+ ``` json5
37
+ // .prettierrc
38
+ {
39
+ " tailwindConfig" : " ./styles/tailwind.config.js"
39
40
}
40
41
```
41
42
@@ -47,10 +48,10 @@ By default this plugin only sorts classes in the `class` attribute as well as an
47
48
48
49
You can sort additional attributes using the ` tailwindAttributes ` option, which takes an array of attribute names:
49
50
50
- ``` js
51
- // prettier.config.js
52
- module . exports = {
53
- tailwindAttributes: [' myClassList' ],
51
+ ``` json5
52
+ // .prettierrc
53
+ {
54
+ " tailwindAttributes" : [" myClassList" ]
54
55
}
55
56
```
56
57
@@ -72,10 +73,10 @@ In addition to sorting classes in attributes, you can also sort classes in strin
72
73
73
74
You can sort classes in function calls using the ` tailwindFunctions ` option, which takes a list of function names:
74
75
75
- ``` js
76
- // prettier.config.js
77
- module . exports = {
78
- tailwindFunctions: [' clsx' ],
76
+ ``` json5
77
+ // .prettierrc
78
+ {
79
+ " tailwindFunctions" : [" clsx" ]
79
80
}
80
81
```
81
82
@@ -106,10 +107,10 @@ This plugin also enables sorting of classes in tagged template literals.
106
107
107
108
You can sort classes in template literals using the ` tailwindFunctions ` option, which takes a list of function names:
108
109
109
- ``` js
110
- // prettier.config.js
111
- module . exports = {
112
- tailwindFunctions: [' tw ' ],
110
+ ``` json5
111
+ // .prettierrc
112
+ {
113
+ " tailwindFunctions" : [" tw " ],
113
114
}
114
115
```
115
116
0 commit comments