Skip to content

Commit

Permalink
Explain how to sort classes in arbitrary strings (#219)
Browse files Browse the repository at this point in the history
* Explain how to sort classes in arbitrary strings

* Tweak wording a bit

* wip

* wip

---------

Co-authored-by: Jordan Pittman <jordan@cryptica.me>
  • Loading branch information
nikwen and thecrypticace committed Oct 4, 2023
1 parent 12d175e commit b5a251e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -129,6 +129,18 @@ function MyScreen() {
}
```

This feature can be used with third-party libraries like `twrnc` or you can create your own tagged template by defining this "identity" function:

```js
const tw = (strings, ...values) => String.raw({ raw: strings }, ...values)
```

Once added, tag your strings with the function and the plugin will sort them:

```js
const mySortedClasses = tw`bg-white p-4 dark:bg-black`
```

## Compatibility with other Prettier plugins

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:
Expand Down

0 comments on commit b5a251e

Please sign in to comment.