如何对 Sass 属性进行排序(例如按字母顺序排列)
How to sort Sass properties (for example in alphabetical order)
我需要 gulp 模块,或者 vscode 扩展,例如,它可以自动对 .sass 文件中的属性进行排序。
我知道 sort-sass npm 模块,但我无法自动化它(它在 CLI 中工作,所以我尝试从 gulp-exec 模块 运行 它)
需要从这里:
text-decoration: none
margin: 0 auto
justify-content: space-between
text-transform: uppercase
width: 500px
align-items: center
color: black
padding: 100px
background-color: white
z-index: 5
height: 100px
display: flex
对此:
display: flex
justify-content: space-between
align-items: center
height: 100px
width: 500px
padding: 100px
margin: 0 auto
background-color: white
color: black
text-decoration: none
text-transform: uppercase
z-index: 5
(看个人喜好,没必要这样)
现在我正在使用带有自动修复功能的 stylelint,这很酷。
谢谢,Tien Duong。我在 vscode 中安装了 CSSComb,在我进行配置后效果很好(需要一些时间来弄清楚它是如何工作的。现在我的属性每次保存文件时都会排序)
我需要 gulp 模块,或者 vscode 扩展,例如,它可以自动对 .sass 文件中的属性进行排序。
我知道 sort-sass npm 模块,但我无法自动化它(它在 CLI 中工作,所以我尝试从 gulp-exec 模块 运行 它)
需要从这里:
text-decoration: none
margin: 0 auto
justify-content: space-between
text-transform: uppercase
width: 500px
align-items: center
color: black
padding: 100px
background-color: white
z-index: 5
height: 100px
display: flex
对此:
display: flex
justify-content: space-between
align-items: center
height: 100px
width: 500px
padding: 100px
margin: 0 auto
background-color: white
color: black
text-decoration: none
text-transform: uppercase
z-index: 5
(看个人喜好,没必要这样)
现在我正在使用带有自动修复功能的 stylelint,这很酷。
谢谢,Tien Duong。我在 vscode 中安装了 CSSComb,在我进行配置后效果很好(需要一些时间来弄清楚它是如何工作的。现在我的属性每次保存文件时都会排序)