Skip to content

Document how to load the Prettier plugin #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/pages/blog/automatic-class-sorting-with-prettier/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,21 @@ This plugin scans your templates for class attributes containing Tailwind CSS cl

It works seamlessly with custom Tailwind configurations, and because it's just a [Prettier](https://prettier.io/) plugin, it works anywhere Prettier works — including every popular editor and IDE, and of course on the command line.

To get started, just install `prettier-plugin-tailwindcss` as a dev-dependency:
To get started, install `prettier-plugin-tailwindcss` as a dev-dependency:

```sh {{ filename: 'Terminal' }}
npm install -D prettier prettier-plugin-tailwindcss
```

This plugin follows Prettier's [autoloading convention](https://prettier.io/docs/en/plugins.html), so as long as you've got Prettier set up in your project, it'll start working automatically as soon as it's installed.
Then add the plugin to your [Prettier configuration file](https://prettier.io/docs/en/configuration):

```json {{ filename: '.prettierrc' }}
{
"plugins": ["prettier-plugin-tailwindcss"]
}
```

You can also [load the plugin by using the `--plugin` flag with the Prettier CLI, or by using the `plugins` option with the Prettier API](https://prettier.io/docs/en/plugins.html#using-plugins).

---

Expand Down