Skip to content

Commit

Permalink
Specify the order of content within declaration blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkudrna committed May 6, 2024
1 parent 4c226d3 commit a786465
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,17 @@ check for properties order:
}
```

The `order` config enforces properties order given by following categories:
The `order` config enforces a consistent order of content in your declaration blocks:

1. Sass variables,
2. CSS custom properties,
3. Sass `@extend`,
4. single-line Sass `@include`,
5. declarations,
6. nested rules,
7. any other at-rules.

Furthermore, properties in the declarations must be ordered by following categories:

1. `all` properties,
2. `content`,
Expand Down
19 changes: 19 additions & 0 deletions order.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ module.exports = {
'stylelint-order',
],
rules: {
'order/order': [
'dollar-variables',
'custom-properties',
{
name: 'extend',
type: 'at-rule',
},
{
hasBlock: false,
name: 'include',
type: 'at-rule',
},
'declarations',
'rules',
{
hasBlock: true,
type: 'at-rule',
},
],
'order/properties-order': [

// All properties
Expand Down

0 comments on commit a786465

Please sign in to comment.