An open API service indexing awesome lists of open source software.

https://github.com/bitcrowd/rehype-sort-tailwind-classes

Sort Tailwind CSS classes in HTML
https://github.com/bitcrowd/rehype-sort-tailwind-classes

rehype rehype-plugin tailwindcss

Last synced: 2 months ago
JSON representation

Sort Tailwind CSS classes in HTML

Awesome Lists containing this project

README

          

# rehype-sort-tailwind-classes

Sort Tailwind CSS classes in HTML.

[![main](https://github.com/bitcrowd/rehype-sort-tailwind-classes/actions/workflows/main.yml/badge.svg)](https://github.com/bitcrowd/rehype-sort-tailwind-classes/actions/workflows/main.yml)

## Install

This package is [ESM-only][esm]: Node 12+ is needed to use it and it must be `imported`ed instead of `required`d.

[npm][]:

```sh
npm install rehype-sort-tailwind-classes
```

This package exports no identifiers. The default export is `rehypeSortTailwindClasses`.

## Use

On the API:

```diff
import { unified } from 'unified';
import rehypeParse from 'rehype-parse';
+import rehypeSortTailwindClasses from 'rehype-sort-tailwind-classes';
import rehypeStringify from 'rehype-stringify';

unified()
.use(rehypeParse)
+ .use(rehypeSortTailwindClasses)
.use(rehypeStringify)
.process('some html', function (err, file) {
console.error(report(err || file));
console.log(String(file));
});
```

On the CLI:

```sh
rehype input.html --use rehype-sort-tailwind-classes --output output.html
```

## Example

##### In

```html


```

##### Out

```html


```

## Options

The plugin accepts any options supported by [Tailwind Classes Sorter][tcs].

Additionally, it supports a `pluginOrder: string[]` option to augment the default plugin ordering.

## License

[MIT](./LICENSE)

[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[npm]: https://docs.npmjs.com/cli/install
[tcs]: https://github.com/Acidic9/tailwind-classes-sorter