Registry /
devops / prettier-plugin-style-order
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ const prettierPluginStyleOrder = require('prettier-plugin-style-order')
✗ import prettierPluginStyleOrder from 'prettier-plugin-style-order'
This plugin is typically not imported directly; Prettier auto-loads it. However, if manually loading, use CommonJS require.
prettier
✓ import { format } from 'prettier'; const result = await format(code, { parser: 'css', plugins: ['prettier-plugin-style-order'] })
✗ import prettier from 'prettier'
Use named export 'format' for programmatic usage. Plugin is passed as string or object in plugins array.
prettier-plugin-style-order
✓ npm install -D prettier-plugin-style-order (then Prettier auto-loads)
✗ npm install -g prettier-plugin-style-order
Plugin is auto-discovered by Prettier when installed locally. No explicit import needed.
Installs the plugin and runs Prettier to sort CSS properties in a file.
// Install: npm install -D prettier prettier-plugin-style-order
// Create a CSS file (example.css):
// .example {
// color: red;
// display: flex;
// position: absolute;
// top: 0;
// background: blue;
// }
// Run: npx prettier --write example.css
// Now example.css is sorted:
// .example {
// position: absolute;
// top: 0;
// display: flex;
// color: red;
// background: blue;
// }
Errors
Common errors & fixes
Cannot find module 'prettier-plugin-style-order'
Plugin not installed or Prettier not using correct node_modules path.
fixRun 'npm install -D prettier-plugin-style-order' in the project root.
Require stack: ...\prettier\index.js [...] \prettier-plugin-style-order\src\index.js
Plugin source is not built; installed from GitHub raw source.
fixInstall from npm registry (prettier-plugin-style-order@0.2.2) instead of GitHub.
Without configuration, plugin is loaded but sorting order may be incorrect for custom groups.
Plugin uses a default order; custom order not supported.
fixAccept default ordering or switch to a more configurable tool like stylelint-order.
Audit
Dependencies
prettieroptionalpeer dependency, plugin requires Prettier >= 1.13