gpt4 book ai didi

css - node.js、css 验证、w3c 禁止我?

转载 作者:太空宇宙 更新时间:2023-11-03 17:38:11 24 4
gpt4 key购买 nike

我提前为我通过翻译写的内容道歉,我的英语很差。

我遇到了以下问题:我需要执行验证 css 文件。为此,我决定使用 NPM 包 w3c-css ,首先它起作用了,但随后开始给出“connected etimedout”,在研究过程中,我注意到通过浏览器和验证器停止工作。

脚本开始时的嗅探器日志:link (<10 代表:()

我的代码:

gulp.task('css', function() {
gulp.src('dev/sass/*.scss')
.pipe(through2.obj(function(file, enc, cb){
w3c_css.validate({text: file.contents.toString('utf8')}, function(err, data) {
if(err) {
// an error happened
console.error(err);
} else {
// validation errors
console.log('validation errors', data.errors);

// validation warnings
console.log('validation warnings', data.warnings);
}

});
cb(null, file);
}))
.pipe(gulp.dest('build/'));
});

这是什么原因?这一定是有什么错误,或者我由于请求太频繁而被阻止并且它没有改变?也许还有其他方法可以检查 css 文件?

谢谢!

最佳答案

来自 W3C 的 CSS 验证服务的“About”页面:

Can I build an application upon this validator? Is there an API?
Yes, and yes. The CSS Validator has a (RESTful) SOAP interface which should make it reasonably easy to build applications (Web or otherwise) upon it. Good manners and respectful usage of shared resources are of course customary: make sure your applications sleep() between calls to the validator, or install and run your own instance of the validator.

是的,看来您已被禁止。

我不知道如何让一个gulp任务不时被调用。你可以mount a local version of the CSS Validator webserviceediting the w3c-css package指向您自己的服务器。

关于css - node.js、css 验证、w3c 禁止我?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29484947/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com