简体   繁体   English

如何更改 Angular CLI 项目中的 Autoprefixer 选项?

[英]How to change Autoprefixer options in Angular CLI project?

I am trying to use grid css in my Angular2 CLI project, however I get the following message:我试图在我的 Angular2 CLI 项目中使用 grid css,但是我收到以下消息:

autoprefixer: IE supports only grid-row with / and span. You should add grid: false option to Autoprefixer and use some JS grid polyfill for full spec support

I looked at https://github.com/postcss/autoprefixer which explains how to set this option in a gulp file, however I'm not sure where in the Angular project I can configure this.我查看了https://github.com/postcss/autoprefixer ,它解释了如何在 gulp 文件中设置此选项,但是我不确定在 Angular 项目中的哪个位置可以配置它。

It is currently not possible to pass options to autoprefixer in angular-cli 1.0 ( issue comment ).目前无法将选项传递给 angular-cli 1.0 中的 autoprefixer( 问题评论)。

There are two options to fix the problem.有两个选项可以解决此问题。

You can selectively disable prefixing inside for a single rule:您可以有选择地禁用单个规则的内部前缀:

.grid-row {    
  /* autoprefixer: off */
  grid-row-start: 1;
  grid-row-end: 2;
  // ... other IE-incompatible configuration
}

You can also use ng eject ( docs ) to output the webpack config of your angular application and modify it.您还可以使用ng eject ( docs ) 输出 angular 应用程序的webpack配置并对其进行修改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM