我正在使用 grunt-jsbeautifier 漂亮地打印 .css 文件,并使用 grunt-contrib-csslint 检查 .css 文件是否存在问题。不幸的是,美化器似乎产生了违反 linter 规则的 CSS。
如果我有这个 CSS:
.half_circle_style a:nth-child(2) {}
...然后 grunt-contrib-csslint 报告“完成,没有错误”。
如果我通过 grunt-jsbeautifier 运行 CSS,则会在 nth-child 之前添加一个空格:
.half_circle_style a: nth-child(2) {}
...这导致 grunt-contrib-csslint 报告:
[L1:C23]
>> Expected LBRACE at line 1, col 23. This rule looks for recoverable syntax errors. (errors)
[L1:C23]
>> Unexpected token 'nth-child(' at line 1, col 23. This rule looks for recoverable syntax errors. (errors)
[L1:C33]
>> Unexpected token '2' at line 1, col 33. This rule looks for recoverable syntax errors. (errors)
[L1:C34]
>> Unexpected token ')' at line 1, col 34. This rule looks for recoverable syntax errors. (errors)
[L1:C36]
>> Unexpected token '{' at line 1, col 36. This rule looks for recoverable syntax errors. (errors)
[L1:C37]
>> Unexpected token '}' at line 1, col 37. This rule looks for recoverable syntax errors. (errors)
我不是 CSS 专家,所以我正在寻找专家意见,拜托 - grunt-jsbeautifier 打印得很糟糕,还是 grunt-contrib-csslint 过于严格?