0

我只是按照 https://github.com/lazd/gulp-csslint遵循如何创建自定义规则,但我不断收到如下错误,不允许我访问 addRule()。

这是我的代码:

// require modules
var gulp = require('gulp');
var csslint = require('gulp-csslint');

csslint.addRule({
    //rule information
    id: "rule-id",
    name: "Rule name",
    desc: "Short description of rule",
    browsers: "Affected browsers",

    //initialization
    init: function(parser, reporter){
        var rule = this;

        //rule initialization
    }
});

// CSS linting task
gulp.task('csslintfred', function(done) {
    return gulp.src('modules/smsc/client/css/parsley.css')
        .pipe(csslint('.csslintrc'))
        .pipe(csslint.reporter())
        .pipe(csslint.reporter(function(file) {
            if(!file.csslint.errorCount) {
                done();
            }
        }));
});


has no method 'addRule'
    at Object.<anonymous> (C:\SMS\Projects\sms_connect\config\gulp-tasks\parsley.js:13:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at requireDir (C:\SMS\Projects\sms_connect\node_modules\require-dir\index.js:116:33)
    at Object.<anonymous> (C:\SMS\Projects\sms_connect\gulpfile.js:14:1)
    at Module._compile (module.js:456:26)
4

1 回答 1

0

好的,最后。

我使用的是 gulp-csslint v1.0.5,在更新到 gulp-csslint-latest v1.0.6 后,一切正常。

奇迹。!!!

于 2015-08-06T01:09:07.633 回答