Vin*_*mes 4 javascript npm package.json stylelint npm-scripts
我正在为一个项目设置 stylelint,从 cli 运行时,一切都按预期工作:
$ stylelint 'css/**/*.css' --fix
css/style.css
20:18 × Expected newline after ":" with a multi-line declaration declaration-colon-newline-after
...
...
Run Code Online (Sandbox Code Playgroud)
但是,当作为npm script无输出运行时(超出记录命令)并且错误似乎被忽略:
$ npm run stylelint
> project lint:css path/project
> stylelint 'css/**/*.css' --fix
Run Code Online (Sandbox Code Playgroud)
包.json
"scripts": {
...
"stylelint": "stylelint 'css/**/*.css' --fix"
},
Run Code Online (Sandbox Code Playgroud)
知道当 stylelint 作为 npm 脚本运行时如何获取控制台输出并退出错误吗?
问题原来是围绕 globstar 模式的引号。大多数其他脚本允许您将 globstar 包裹在单引号中',但是 stylelint 似乎需要转义双引号:
"stylelint": "stylelint \"src/**/*.css\" --fix"
| 归档时间: |
|
| 查看次数: |
735 次 |
| 最近记录: |