解决Stylelint --fix后会把vue文件中css以外的部分删除掉
问题:–fix自动修复会把Vue文件中所有内容都移除掉,只剩css代码解决方案:移除配置中的processors项原因: 网上一些过时的教程包括 github 上的讨论都推荐使用 stylelint-processor-html 或者 @mapbox/stylelint-processor-arbitrary-tags 来解析 html 或 vue 中的 css ,这本身并没有什么问题,但是这..
·
问题:–fix自动修复会把Vue文件中所有内容都移除掉,只剩css代码
解决方案:移除配置中的processors项
原因: 网上一些过时的教程包括 github 上的讨论都推荐使用 stylelint-processor-html
或者 @mapbox/stylelint-processor-arbitrary-tags
来解析 html 或 vue 中的 css ,这本身并没有什么问题,但是这个插件有个 bug ,当指定 stylelint 的 --fix
后将会把 vue 文件中 以外的部分删掉。
//.stylelintrc
{
"extends": ["stylelint-config-standard"],
"plugins": ["stylelint-order"],
"rules": {
"order/order": [
"custom-properties",
"declarations"
],
"order/properties-alphabetical-order": true,
"no-empty-source": null,
}
}
//package.json
"scripts": {
"lint:css": "stylelint **/*.{vue,css,sass,scss} --fix",
"build": "node build/build.js"
},
更多推荐
已为社区贡献3条内容
所有评论(0)