Skip to content

Commit 5cef731

Browse files
committed
Update migration guide
1 parent fa5cc4a commit 5cef731

File tree

1 file changed

+18
-65
lines changed

1 file changed

+18
-65
lines changed

README.md

Lines changed: 18 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -41,75 +41,18 @@ a {
4141
}
4242
```
4343

44-
## Migration from `1.x`
44+
## Migration from `2.x`
4545

46-
If you have been using [predefined configs], you can look at [migrated predefined configs].
46+
Remove all `*-empty-line-before` and `clean-empty-lines` options. Use [stylelint] with `--fix` option instead.
4747

48-
`sort-order` was split into [`order`](./docs/order.md) and [`properties-order`](./docs/properties-order.md).
49-
50-
`properties-order` now uses an array of objects for grouping.
51-
52-
`sort-order` keywords to new config conversion:
53-
54-
| `1.x` | `2.x` |
55-
| --- | --- |
56-
| `@atrule` | `{ order: ["at-rules"] }` or `{ order: [{ type: "at-rule" }] }` |
57-
| `@atrulename` | `{ order: [{ type: "at-rule", name: "atrulename" }] }` |
58-
| `@atrulename parameter` | `{ order: [{ type: "at-rule", name: "atrulename", parameter: "parameter" }] }` |
59-
| `>child` | `{ order: ["rules"] }` |
60-
| `$variable` | `{ order: ["custom-properties", "dollar-variables"] }` |
61-
| “leftovers” token `...` | `{ "unspecified-properties-position": "bottom" }` |
62-
63-
Config for `1.x`:
64-
65-
```js
66-
{
67-
"sort-order": [
68-
[
69-
"$variable"
70-
],
71-
[
72-
"margin",
73-
"padding"
74-
],
75-
[
76-
"border",
77-
"background"
78-
],
79-
[
80-
'...',
81-
"at-rule",
82-
"@include",
83-
"@include media",
84-
">child"
85-
]
86-
]
87-
}
88-
```
48+
`properties-order` doesn't support property groups. Convert it to simple array. Use [stylelint-order] with `--fix` option for empty line before property groups.
8949

9050
Config for `2.x`:
9151

92-
```js
52+
```json
9353
{
94-
"order": [
95-
"custom-properties",
96-
"dollar-variables",
97-
"declarations",
98-
"at-rules",
99-
{
100-
"type": "at-rule",
101-
"name": "include"
102-
},
103-
{
104-
"type": "at-rule",
105-
"name": "include",
106-
"parameter": "icon"
107-
},
108-
"rules"
109-
],
11054
"properties-order": [
11155
{
112-
"emptyLineBefore": true,
11356
"properties": [
11457
"margin",
11558
"padding"
@@ -122,8 +65,20 @@ Config for `2.x`:
12265
"background"
12366
]
12467
}
125-
],
126-
"unspecified-properties-position": "bottom"
68+
]
69+
}
70+
```
71+
72+
Config for `3.x`:
73+
74+
```json
75+
{
76+
"properties-order": [
77+
"margin",
78+
"padding"
79+
"border",
80+
"background"
81+
]
12782
}
12883
```
12984

@@ -205,8 +160,6 @@ If you want format style sheets, use [perfectionist] or [stylefmt], also a PostC
205160
[Sublime Text plugin]: https://github.com/hudochenkov/sublime-postcss-sorting
206161
[Atom plugin]: https://github.com/lysyi3m/atom-postcss-sorting
207162
[VS Code plugin]: https://github.com/mrmlnc/vscode-postcss-sorting
208-
[predefined configs]: https://github.com/hudochenkov/postcss-sorting/tree/ee71c3b61eea8fa11bc3aa2d26dd99a832df6d54/configs
209-
[migrated predefined configs]: https://gist.github.com/hudochenkov/b7127590d3013a5982ed90ad63a85306
210163

211164
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
212165
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss

0 commit comments

Comments
 (0)