gpt4 book ai didi

gruntjs - 警告 : [object Object] is not a PostCSS plugin. 带有自动前缀的 GruntJS

转载 作者:行者123 更新时间:2023-12-05 00:53:26 32 4
gpt4 key购买 nike

我正在尝试将 PostCSS 插件 autoprefixer 与 grunt 一起使用。我浏览了许多相关的文章和 Stackoverflow 答案,但我仍然收到“警告:[object Object] 不是 PostCSS 插件使用 --force 继续”。

    grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
files: {
'css/style.css' : 'scss/style.scss'
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['sass']
}
},
postcss: {
options: {
map: true,
processors: [
require('autoprefixer')()
]
},
dist: {
src: 'css/*.css'
}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('dev',['sass','watch']);
grunt.registerTask('build',['sass', 'postcss']);
}

package.json
"devDependencies": {
"grunt": "^1.4.0",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-postcss": "^0.9.0",
"postcss": "^8.3.0",
"autoprefixer": "^10.2.6"
}


I am a newbie so please help.

最佳答案

尚不确定根本原因是什么,但将 autoprefixer 降级到版本 9 可以解决问题

package.json
"devDependencies": {
"grunt": "^1.4.0",
"grunt-contrib-sass": "^2.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-postcss": "^0.9.0",
"postcss": "^8.3.0",
"autoprefixer": "^9.8.6"
}

关于gruntjs - 警告 : [object Object] is not a PostCSS plugin. 带有自动前缀的 GruntJS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67847162/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com