在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):callumacrae/gulp-w3cjs开源软件地址(OpenSource Url):https://github.com/callumacrae/gulp-w3cjs开源编程语言(OpenSource Language):JavaScript 96.5%开源软件介绍(OpenSource Introduction):gulp-w3cjsUsageFirst, install npm install --save-dev gulp-w3cjs Then, add it to your var w3cjs = require('gulp-w3cjs');
gulp.task('w3cjs', function () {
return gulp.src('src/*.html')
.pipe(w3cjs())
.pipe(w3cjs.reporter());
}); Custom ReportingThe results are also added onto each file object under Example usage var w3cjs = require('gulp-w3cjs');
var through2 = require('through2');
gulp.task('example', function () {
return gulp.src('src/*.html')
.pipe(w3cjs())
.pipe(through2.obj(function(file, enc, cb){
cb(null, file);
if (!file.w3cjs.success){
throw new Error('HTML validation error(s) found');
}
}));
}); Example output HTML Error: index.html Line 5, Column 19: Element title must not be empty.
<title></title>
.../gulpfile.js:11
throw new Error('HTML validation error(s) found');
^
Error: HTML validation error(s) found APIw3cjs(options)options.urlURL to the w3c validator. Use if you want to use a local validator. This is the
same thing as options.proxyHttp address of the proxy server if you are running behind a firewall, e.g.
options.showInfoDefault: Show options.verifyMessageAllows you to intercept info, warnings or errors, using return gulp.src('index.html')
.pipe(w3cjs({
verifyMessage: function(type, message) {
// prevent logging error message
if(message.indexOf('Element “style” not allowed as child of element') === 0) return false;
// allow message to pass through
return true;
}
}))
.pipe(w3cjs.reporter()) w3cjs.setW3cCheckUrl(url)Same as options.url. SEt's the URL to the w3c validator. License |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论