@18f/stylelint-rules 中文文档教程
stylelint-rules
18F 样式指南
的样式(CSS、Sass)linter 该模块的目的是为 前端项目,不需要额外依赖 ruby。 它 利用 stylelint 和 postCSS 执行许多与 scss-lint。
Usage Information
要开始,请运行 npm install --save-dev @18f/stylelint-rules
。 这添加了模块 到您的项目并将依赖项保存到您的 package.json。
stylelint-rules 提供了两种运行 linter 的方法:通过命令行,以及 通过吞咽。
Run via gulp
要使用 gulp 运行 linter,请将模块导入 gulpfile: var stylelint = require('@18f/stylelint-rules');
stylelint 函数接受两个参数:
files
:required 一组文件你想要皮棉。 例如 './src/scss/**/*.scss'options
: optional 配置选项的对象。{ syntax: Syntax the linter validates against. Valid options are `scss|css|less`. Defaults to scss ignore: A glob (or array of globs) of files the linter should ignore, config: A path to a stylelint config file. File should use the same conventions as the config file found in this repository, exporting a single javascript object. }
gulp 任务示例:
var lintFunction = stylelint('./src/css/**/*.scss', {
ignore: 'some/lib/**/*.scss'
});
gulp.task('my-lint-task', lintFunction);
Run via the command line
linter 也可以使用命令行运行。 脚本安装在 node_modules 目录的 .bin 文件夹。 脚本唯一需要的参数是要被检查的目录(或单个文件的路径)。
例如:node_modules/.bin/18f-stylelint-rules "./path/to/sass/**/*.scss"
此外,CLI 公开了以下选项:
-s, --syntax [scss|css|less], Linter syntax. Defaults to scss.
-i, --ignore-files [string], Glob of directories or files to ignore
-f, --formatter [verbose|json|string], Output formatter. Defaults to verbose.
-c, --config [rules], Path to a js file that exports an object describing additional rules.
Contributing
请参阅 CONTRIBUTING.md。
stylelint-rules
A style (CSS, Sass) linter for the 18F style guide
The aim of this module is to present a sensible set of linting defaults for front-end projects, without requiring an additional dependency on ruby. It leverages stylelint and postCSS to perform many of the same linting functions as scss-lint.
Usage Information
To get started, run npm install --save-dev @18f/stylelint-rules
. This adds the module to your project and saves the dependency to your package.json.
stylelint-rules provides two ways to run its linter: via the command line, and via gulp.
Run via gulp
To run the linter using gulp, import the module into your gulpfile: var stylelint = require('@18f/stylelint-rules');
The stylelint function accepts two arguments:
files
: required A glob of files you want to lint. For example './src/scss/**/*.scss'options
: optional An object of configuration options.{ syntax: Syntax the linter validates against. Valid options are `scss|css|less`. Defaults to scss ignore: A glob (or array of globs) of files the linter should ignore, config: A path to a stylelint config file. File should use the same conventions as the config file found in this repository, exporting a single javascript object. }
Example gulp task:
var lintFunction = stylelint('./src/css/**/*.scss', {
ignore: 'some/lib/**/*.scss'
});
gulp.task('my-lint-task', lintFunction);
Run via the command line
The linter can also be run using the command line. The script is installed in the .bin folder of your node_modules directory. The only required argument to the script is a glob of directories (or path to a single file) to be linted.
For example: node_modules/.bin/18f-stylelint-rules "./path/to/sass/**/*.scss"
Additionally, the CLI exposes the following options:
-s, --syntax [scss|css|less], Linter syntax. Defaults to scss.
-i, --ignore-files [string], Glob of directories or files to ignore
-f, --formatter [verbose|json|string], Output formatter. Defaults to verbose.
-c, --config [rules], Path to a js file that exports an object describing additional rules.
Contributing
Please see CONTRIBUTING.md.
你可能也喜欢
- 3vbyq06j1lssbvjrabcl5i1edem06ois 中文文档教程
- @0x-lerna-fork/output 中文文档教程
- @0xcert/ethereum-bitski-frontend-provider 中文文档教程
- @1e3/eslint-config-1e3-react 中文文档教程
- @1onlinesolution/dws-mail 中文文档教程
- @51xuanshi/wxapp_component 中文文档教程
- @7span/vue-list 中文文档教程
- @8pattern/jmiddleware 中文文档教程
- @aakashdeveloper/create-node-app 中文文档教程
- @aardvarkxr/room-server 中文文档教程