在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):tschortsch/gulp-bootlint开源软件地址(OpenSource Url):https://github.com/tschortsch/gulp-bootlint开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):gulp-bootlintA gulp wrapper for Bootlint, the HTML linter for Bootstrap projects. Requirements
First stepsIf you are familiar with gulp just install the plugin from npm with the following command:
Otherwise check out the Getting Started guide of gulp first. Create a new gulp taskAfter installing the plugin you can create a new gulp task in your var gulp = require('gulp');
var bootlint = require('gulp-bootlint');
gulp.task('bootlint', function() {
return gulp.src('./index.html')
.pipe(bootlint());
}); OptionsYou can pass the following options as a single object when calling the bootlint plugin. options.stoponerror
Stops the gulp task if there are errors in the linted file. options.stoponwarning
Stops the gulp task if there are warnings in the linted file. options.disabledIds
Array of bootlint problem ID codes (as options.issues
All found issues (Objects of type The classes options.reportFn
A function that will log out the lint errors to the console. Only use this if you want to customize how the lint errors are reported.
If desired, this can be turned off entirely by setting options.summaryReportFn
A function that will log out the final lint error/warning summary to the console. Only use this if you want to customize how this is reported.
If desired, this can be turned off entirely by setting Example of options usage:var gulp = require('gulp');
var bootlint = require('gulp-bootlint');
gulp.task('bootlint', function () {
var fileIssues = [];
return gulp.src('./index.html')
.pipe(bootlint({
stoponerror: true,
stoponwarning: true,
disabledIds: ['W009', 'E007'],
issues: fileIssues,
reportFn: function (file, lint, isError, isWarning, errorLocation) {
var message = (isError) ? 'ERROR! - ' : 'WARN! - ';
if (errorLocation) {
message += file.path + ' (line:' + (errorLocation.line + 1) + ', col:' + (errorLocation.column + 1) + ') [' + lint.id + '] ' + lint.message;
} else {
message += file.path + ': ' + lint.id + ' ' + lint.message;
}
console.log(message);
},
summaryReportFn: function(file, errorCount, warningCount) {
if (errorCount > 0 || warningCount > 0) {
console.log('please fix the ' + errorCount + ' errors and ' + warningCount + ' warnings in ' + file.path);
} else {
console.log('No problems found in ' + file.path);
}
},
}));
}); Log levelTo set the log level please use the
Available log levels are listed here: https://github.com/medikoo/log#available-log-levels Changelog
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论