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

I am trying to enable Autoprefixer Grid translations in a Create React App application.

I do not want to eject.

I’m also using a CSS-in-JS solution that makes it impossible to add comments to the CSS. So the /* autoprefixer grid: autoplace */ control comment method is not possible.

Is it still possible to enable grid translations without ejecting?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

At the time of asking, it was not possible. It is now though.

If you apply an AUTOPREFIXER_GRID = autoplace environment variable when you are compiling your code, you can enable grid translations without using control comments.

You can read about how to do this in the Autoprefixer documentation.

Solution 2

As mentioned in 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.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply