如何解决object Object 不是 PostCSS 插件 | PostCSS 自动前缀
我正在尝试使用 Grunt PostCSS Autoprefixer,但它一直说它不是 PostCSS 插件:
package.json
{
"name": "test","version": "0.2.0","description": "test","keywords": [
""
],"author": "","license": "","scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},"dependencies": {
"cssmin": "^0.4.3","cssnano": "^5.0.6","grunt": "^1.4.1","grunt-babel": "^8.0.0","grunt-contrib-cssmin": "^4.0.0","grunt-contrib-uglify": "^5.0.1","grunt-contrib-watch": "^1.1.0"
},"devDependencies": {
"@babel/core": "^7.14.5","@babel/preset-env": "^7.14.5","autoprefixer": "^10.2.6","grunt-postcss": "^0.9.0","grunt-postcss-import": "0.0.1","grunt-prettify": "^0.4.0","postcss": "^8.3.2"
}
}
Gruntfile.js
postcss: {
options: {
map: {
inline: false,annotation: 'dist/css/maps/'
},processors: [
// require('pixrem')(),require('autoprefixer')(),//require('cssnano')()
]
},dist: {
src: 'dist/css/bundle.css'
}
},
我确保首先删除 grunt-autoprefixer
并安装 autoprefixer
,它应该是一个 postcss 插件。
解决方法
事实证明这只是一个版本兼容性问题。我只是改变了:
"autoprefixer": "^10.2.6",
与:
"autoprefixer": "^9.7.4",
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。