簡體   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