# prettier-plugin-css-order

> Sort CSS declarations in a certain order.

Latest version **2.2.0** (published 2026-01-02) · ISC license · 0 weekly downloads

## Install

```sh
npm install prettier-plugin-css-order
pnpm add prettier-plugin-css-order
yarn add prettier-plugin-css-order
bun add prettier-plugin-css-order
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities; has provenance.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2026-01-02 |
| First published | 2021-07-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 3 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 185 |
| Author | Selwyn |
| Maintainers | siilwyn |
| Keywords | prettier, prettier-plugin, css, scss, less, declaration, sorter, property, order |

## Links

- npm: https://www.npmjs.com/package/prettier-plugin-css-order
- Repository: https://github.com/Siilwyn/prettier-plugin-css-order
- Homepage: https://github.com/Siilwyn/prettier-plugin-css-order#readme
- Issues: https://github.com/Siilwyn/prettier-plugin-css-order/issues
- npm.io page: https://npm.io/package/prettier-plugin-css-order

## Dependencies (3)

- [postcss-less](https://npm.io/package/postcss-less.md) ^6.0.0
- [postcss-scss](https://npm.io/package/postcss-scss.md) ^4.0.9
- [css-declaration-sorter](https://npm.io/package/css-declaration-sorter.md) ^7.3.0

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 2.2.0 (latest) — 2026-01-02
- 2.1.2 — 2024-04-01
- 2.1.1 — 2024-03-26
- 2.1.0 — 2024-03-25
- 2.0.1 — 2023-10-01
- 2.0.0 — 2023-07-29
- 1.3.1 — 2023-06-08
- 1.3.0 — 2022-07-25
- 1.2.0 — 2022-04-09
- 1.1.0 — 2022-01-08
- 1.0.0 — 2021-07-27

## README

# CSS Order Prettier Plugin
[![npm][npm-badge]][npm]

A [Prettier](https://prettier.io/) plugin to sort CSS, SCSS or Less declarations based on their property names.  
Using [css-declaration-sorter](https://github.com/Siilwyn/css-declaration-sorter/) under the hood.

## Usage
Following the Prettier plugin guidelines, this package depends on Prettier as a peer dependency:  
`npm install prettier-plugin-css-order --save-dev`

To enable the plugin use the Prettier API, CLI or configuration file. For example using the JS configuration:
```js
{
  plugins: ["prettier-plugin-css-order"]
}
```

### Configuration
This plugin adds two configurable keys to Prettier:
- [`cssDeclarationSorterOrder`](https://github.com/Siilwyn/css-declaration-sorter#order) defaults to `concentric-css`.
- [`cssDeclarationSorterKeepOverrides`](https://github.com/Siilwyn/css-declaration-sorter#keepoverrides) defaults to `true`, for a new codebase `false` is recommended.
- `cssDeclarationSorterCustomOrder`, an array of property names, their order is used to sort with. This overrides the `cssDeclarationSorterOrder` option!

[npm]: https://www.npmjs.com/package/prettier-plugin-css-order
[npm-badge]: https://tinyshields.dev/npm/prettier-plugin-css-order.svg

---
_Source: https://npm.io/package/prettier-plugin-css-order · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
