在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):bezoerb/gulp-htmlhint开源软件地址(OpenSource Url):https://github.com/bezoerb/gulp-htmlhint开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-htmlhintUsageFirst, install npm install --save-dev gulp-htmlhint Then, add it to your var htmlhint = require("gulp-htmlhint");
gulp.src("./src/*.html")
.pipe(htmlhint()) APIhtmlhint([options [, customRules]])optionsSee all rules here: https://github.com/HTMLHint/HTMLHint/wiki/Rules If options.htmlhintrcType: If this filename is specified, options and globals defined there will be used. Task and target options override the options within the {
"tag-pair": true
} var htmlhint = require("gulp-htmlhint");
gulp.src("./src/*.html")
.pipe(htmlhint('.htmlhintrc')) customRulesType: Array that contains all user-defined custom rules. Rules added to this param need not exist in the {
id: 'my-custom-rule',
description: 'Custom rule definition',
init: function(parser, reporter){
//Code goes here
}
} Here is an example: var htmlhint = require("gulp-htmlhint");
var customRules = [];
customRules.push({
id: 'my-custom-rule',
description: 'Custom rule definition',
init: function(parser, reporter){
//Code goes here
}
});
gulp.src("./src/*.html")
.pipe(htmlhint('.htmlhintrc', customRules)) Note: You can call
ReportersDefault reportervar htmlhint = require("gulp-htmlhint");
gulp.src("./src/*.html")
.pipe(htmlhint())
.pipe(htmlhint.reporter()) Fail reportersfailOnErrorUse this reporter if you want your task to fail on the first file that triggers an HTMLHint Error. It also prints a summary of all errors in the first bad file. var htmlhint = require("gulp-htmlhint");
gulp.src("./src/*.html")
.pipe(htmlhint())
.pipe(htmlhint.failOnError()) failAfterErrorUse this reporter if you want to collect statistics from all files before failing. It also prints a summary of all errors in the first bad file. var htmlhint = require("gulp-htmlhint");
gulp.src("./src/*.html")
.pipe(htmlhint())
.pipe(htmlhint.failAfterError()) Reporter optionsOptionally, you can pass a config object to either fail reporter. suppressType: When set to var htmlhint = require("gulp-htmlhint");
gulp.src("./src/*.html")
.pipe(htmlhint())
.pipe(htmlhint.reporter("htmlhint-stylish"))
.pipe(htmlhint.failOnError({ suppress: true })) Third-party reportersgulp-reporter used in team project, it fails only when error belongs to the current author of git. License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论