Skip to content

Commit b5a251e

Browse files
nikwenthecrypticace
andauthoredOct 4, 2023
Explain how to sort classes in arbitrary strings (#219)
* Explain how to sort classes in arbitrary strings * Tweak wording a bit * wip * wip --------- Co-authored-by: Jordan Pittman <[email protected]>
1 parent 12d175e commit b5a251e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎README.md

+12
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ function MyScreen() {
129129
}
130130
```
131131

132+
This feature can be used with third-party libraries like `twrnc` or you can create your own tagged template by defining this "identity" function:
133+
134+
```js
135+
const tw = (strings, ...values) => String.raw({ raw: strings }, ...values)
136+
```
137+
138+
Once added, tag your strings with the function and the plugin will sort them:
139+
140+
```js
141+
const mySortedClasses = tw`bg-white p-4 dark:bg-black`
142+
```
143+
132144
## Compatibility with other Prettier plugins
133145

134146
This plugin uses Prettier APIs that can only be used by one plugin at a time, making it incompatible with other Prettier plugins implemented the same way. To solve this we've added explicit per-plugin workarounds that enable compatibility with the following Prettier plugins:

0 commit comments

Comments
 (0)
Please sign in to comment.