webstrom 保存时自动 stylelint fix,无需额外的 csscomb 插件及配置
可通过 npm config get prefix 查看 npm 安装目录
IDE Stylelint fix on save
配置:
npm i stylelint -g
IDE 配置(Settings - Tools - File Watchers - +)
- C:\Users\Administrator\AppData\Roaming\npm\stylelint
- $FileName$ --fix
- $FileName$
- $FileDir$
项目需要安装stylelint
package.json 文件
"devDependencies": {
"stylelint": "9.10.1",
"stylelint-config-css-modules": "^1.4.0",
"stylelint-config-prettier": "^5.0.0",
"stylelint-config-rational-order": "^0.1.0",
"stylelint-config-standard": "^18.3.0",
"stylelint-declaration-block-no-ignored-properties": "^1.1.0",
"stylelint-order": "^2.2.1",
}
配置 .stylelintrc文件
{
"extends": [
"stylelint-config-standard",
"stylelint-config-css-modules",
"stylelint-config-rational-order",
"stylelint-config-prettier"
],
"plugins": ["stylelint-order", "stylelint-declaration-block-no-ignored-properties"],
"rules": {
"no-descending-specificity": null,
"plugin/declaration-block-no-ignored-properties": true,
"at-rule-no-unknown": null
}
}