【发布时间】:2020-03-08 22:27:45
【问题描述】:
当我尝试使用 autoprefixer 为我的 css 加上前缀时,我遇到了错误。下面是我的 package.json 文件。 Screenshot
{
"name": "natours",
"version": "1.0.0",
"description": "Landing page for natours",
"main": "index.js",
"scripts": {
"watch:sass": "node-sass sass/main.scss css/style.css -w",
"compile:sass": "node-sass sass/main.scss css/style.comp.css",
"concat:css": "concat -o css/style.concat.css css/icon-font.css css/style.comp.css",
"prefix:css": "postcss --use autoprefixer -b 'last 5 versions' css/style.concat.css -o css/style.prefix.css"
},
"author": "Kenny",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^9.7.1",
"concat": "^1.0.3",
"node-sass": "^4.12.0",
"postcss-cli": "^6.1.3"
}
}
【问题讨论】:
-
您还需要 postcss 在您只包含 postcss-cli 的开发依赖项中
-
我明白了,所以我所做的是我也安装了 postcss。 npm install postcss --save-dev 以便将其添加为开发依赖项并且确实如此。但我仍然无法成功为我的 css imgur.com/IVpODBn 添加前缀
标签: sass node-sass autoprefixer