https://github.com/xgfe/xg-csshint
postcss-plugin csshint xgfe
https://github.com/xgfe/xg-csshint
Last synced: 18 days ago
JSON representation
postcss-plugin csshint xgfe
- Host: GitHub
- URL: https://github.com/xgfe/xg-csshint
- Owner: xgfe
- Created: 2015-12-18T09:38:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-11-26T14:45:42.000Z (over 6 years ago)
- Last Synced: 2025-03-27T16:53:03.543Z (about 2 months ago)
- Language: JavaScript
- Size: 101 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
Awesome Lists containing this project
README
# xg-csshint
支持规范:[xgfe-css规范](https://github.com/xgfe/codeguide/blob/master/css.md)
## 使用方法
在项目目录下创建一个.csshintrc,`files`指定需要检测的文件,`ignore`指定忽略内容.具体设置可以参照[glob语法](https://github.com/isaacs/node-glob)
```
{
"files":["css/**/*.css"],
"ignore":"css/**/*.test.css"
}
```安装程序
```
npm install -g xg-csshint
xg-csshint
```## 参数
- -v||-version 打印当前版本
- -p 手动指定config文件
- -f 指定需要检测的css路径 注意-f中的路径会覆盖config中的路径## 引入使用方法
```
var fs = require("fs");
var csshint = require("xg-csshint");
var config = {};
var cssParse=csshint(config);fs.readFile('./disallow-import.css',function(err,res){
var css=res.toString();
cssParse(css);
...
})
```
[规则参考](https://github.com/xgfe/xg-csshint/blob/master/src/config.js)
返回一个messages数组```
[{
text, //报错信息
line, //错误行
column, //错误列
level, //错误等级,1 error 2 warning
content, //css错误片段
plugin //规则名称
}]
```
## ChangeLog
[changelog](https://github.com/xgfe/xg-csshint/blob/master/ChangeLog.md)