如何在不使用控件注释的情况下在 create-react-app 中启用 Autoprefixer CSS 网格翻译?

How do you enable Autoprefixer CSS Grid translations in create-react-app without using control comments?

我正在尝试在 Create React App 应用程序中启用 Autoprefixer Grid 翻译。

我不想弹出

我也在使用 CSS-in-JS 解决方案,这使得无法向 CSS 添加评论。所以/* autoprefixer grid: autoplace */控制注释的方法是不行的

是否仍然可以在不弹出的情况下启用网格翻译?

the official documentation所述:

CSS Grid Layout prefixing is disabled by default, but it will not strip manual prefixing. If you'd like to opt-in to CSS Grid prefixing, first familiarize yourself about its limitations.

To enable CSS Grid prefixing, add /* autoprefixer grid: autoplace */ to the top of your CSS file.

在询问的时候,是不可能的。现在是了。

如果您在编译代码时应用 AUTOPREFIXER_GRID = autoplace 环境变量,则无需使用控制注释即可启用网格翻译。

您可以在 Autoprefixer documentation 中阅读有关如何执行此操作的信息。