繁体   English   中英

无法在Gruntfile中使用Postcss Reporter和Postcss Bem Linter记录错误

[英]Unable to log error with postcss reporter and postcss bem linter in Gruntfile

我在gruntfile.js中使用grunt-postcss,并且一切正常,除了postcss-bem-linter,如果不遵循BEM规则,它应该在控制台中记录警告。 这是gruntfile.js中的一小段配置:

var preprocessorsAfterSprites = [
    require('postcss-bem-linter')(function (a) {
        console.log(a);
    }), // this just doesn't want to work right now
    require('postcss-reporter')
];

function getPostCssPreprocessors(name) {
    return preprocessorsAfterSprites;
}

grunt.initConfig({
    postcss: {
        options: {
            map: { inline: false }
        },
        golden: {
            src: '<%= dirs.pcss %>/golden/main.scss',
            dest: '<%= dirs.css %>/golden.css',
            options: {
                processors: getPostCssPreprocessors('golden')
            }
        }
    }
});

当我尝试输入grunt postcss:golden时,控制台日志中没有任何输出。 有什么想法吗?

postcss-bem-linter不接受回调( https://github.com/postcss/postcss-bem-linter )。 所以我不知道您为什么认为require('postcss-bem-linter')(function (a) { console.log(a); })应该起作用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM