Can be used within IDEs or code editors to sort CSS properties in a consistent order on code reformat command.
- Open the code style settings for CSS, SCSS or SASS (according to your needs)
- File | Settings | Editor | Code Style | Style Sheets | SCSS for Windows and Linux
- Your IDE | Settings | Editor | Code Style | Style Sheets | SCSS for macOS
- Open the tab "Arrangement"
- Select "Custom order"
- Add the CSS properties from
css-order.txt
Read more about Code Style Arrangement in the JetBrains documentation.
- Install the PostCSS Sorting extension
- Add the CSS properties from
css-order.txt
to the extension settings - Override the Keybinding to perform the sorting on save
[
{
"key": "cmd+s",
"command": "runCommands",
"when": "resourceExtname =~ /^.(scss|sass|css)$/",
"args": {
"commands": [
"postcssSorting.execute",
"workbench.action.files.save"
]
}
}
]
Thanks to Sebastian Richter for providing these instructions.
Inspired by Concentric CSS from Brandon Rhodes.