prettier-plugin-css-order

Sort CSS declarations in a certain order.

ISC 11 个版本
安装
npm install prettier-plugin-css-order
yarn add prettier-plugin-css-order
pnpm add prettier-plugin-css-order
bun add prettier-plugin-css-order
README

CSS Order Prettier Plugin

npm

A Prettier plugin to sort CSS, SCSS or Less declarations based on their property names.
Using 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:

{
  plugins: ["prettier-plugin-css-order"]
}

Configuration

This plugin adds two configurable keys to Prettier:

  • cssDeclarationSorterOrder defaults to concentric-css.
  • cssDeclarationSorterKeepOverrides 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!
版本列表
2.2.0 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