[英]Unable to log error with postcss reporter and postcss bem linter in Gruntfile
I am using grunt-postcss in my gruntfile.js and everything works fine except the postcss-bem-linter which should log warning in the console if the BEM rules are not followed. 我在gruntfile.js中使用grunt-postcss,并且一切正常,除了postcss-bem-linter,如果不遵循BEM规则,它应该在控制台中记录警告。 Here a snippet of configuration in gruntfile.js:
这是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')
}
}
}
});
When I try to type grunt postcss:golden I dont have any output from the console log. 当我尝试输入grunt postcss:golden时,控制台日志中没有任何输出。 Any ideas why?
有什么想法吗?
postcss-bem-linter does not accept a callback ( https://github.com/postcss/postcss-bem-linter ). postcss-bem-linter不接受回调( https://github.com/postcss/postcss-bem-linter )。 So I don't know why you think that
require('postcss-bem-linter')(function (a) { console.log(a); })
should work. 所以我不知道您为什么认为
require('postcss-bem-linter')(function (a) { console.log(a); })
应该起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.