Grunt 新手,正在尝试为 WordPress 项目运行 Gruntfile。我的根目录中有一个 package.json 和 Gruntfile.js 。我想添加 grunt-postcss,但是当我按照说明操作时,我不断收到“警告:未找到任务“grunt-postcss””。我可能设置了 Grunt 错误,因为无论我运行什么,我都会遇到找不到任务的情况。这是我的 Gruntfile 内容:
module.exports = function(grunt) {
grunt.initConfig({
postcss: {
options: {
map: true, // inline sourcemaps
processors: [
require('pixrem')(), // add fallbacks for rem units
require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes
require('cssnano')() // minify the result
]
},
dist: {
src: 'css/*.css'
}
}
});
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', ['grunt-postcss']);
};
最佳答案
确保您已经安装了 grunt-postcss 模块。
npm 安装 grunt-postcss --save-dev
关于javascript - 咕噜postcss "not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33686239/