如何在 angular 中使用 postcss/autoprefixer
How do I use postcss/autoprefixer in angular
我已经通读了这个问题#1521
关于如何使用postcss/autoprefixer我还不是很清楚
我只是npm install autoprefixer --save-dev
吗?
这是正确的做法吗?
我也阅读了 postcss/autoprefixer 文档我仍然不明白如何去做
请帮忙,谢谢
更新
使用 SCSS,脚本运行
postcss --parser postcss-scss -u autoprefixer --autoprefixer.browsers \"last 2 versions\" -r src/**/*.scss
我已经安装了 *postcss postcss-cli autoprefixer 作为开发依赖项
npm install --save-dev postcss postcss-cli autoprefixer
然后在 package.json 文件中创建一个 npm 脚本到 运行 postcss cli 和自动前缀器,就像这样
"script": {
...
"prefixcss": "postcss -u autoprefixer --autoprefixer.browsers 'last 2 versions' -r src/**/*.css",
...
}
然后运行重建之前的脚本
npm run prefixcss
AFAIK 从 Angular v11.2 开始,PostCSS 已经添加到 angular cli 中。开箱即用的自动前缀器也已启用。
如果要配置 PostCSS,只需创建一个 postcss.config.js
文件。
我已经通读了这个问题#1521
关于如何使用postcss/autoprefixer我还不是很清楚
我只是npm install autoprefixer --save-dev
吗?
这是正确的做法吗?
我也阅读了 postcss/autoprefixer 文档我仍然不明白如何去做
请帮忙,谢谢
更新 使用 SCSS,脚本运行
postcss --parser postcss-scss -u autoprefixer --autoprefixer.browsers \"last 2 versions\" -r src/**/*.scss
我已经安装了 *postcss postcss-cli autoprefixer 作为开发依赖项
npm install --save-dev postcss postcss-cli autoprefixer
然后在 package.json 文件中创建一个 npm 脚本到 运行 postcss cli 和自动前缀器,就像这样
"script": {
...
"prefixcss": "postcss -u autoprefixer --autoprefixer.browsers 'last 2 versions' -r src/**/*.css",
...
}
然后运行重建之前的脚本
npm run prefixcss
AFAIK 从 Angular v11.2 开始,PostCSS 已经添加到 angular cli 中。开箱即用的自动前缀器也已启用。
如果要配置 PostCSS,只需创建一个 postcss.config.js
文件。