Autoprefixer never outputs -webkit-flex
See original GitHub issueWe’ve been conducting a lengthy tests to narrow down an issue which is having an effect on iOS 7-8 users predominantly in one of our new projects. It has to do with display: flex
. What’s missing in action is webkit prefixes for post 2009 flexbox.
The following browser versions require the -webkit
vendor prefix for flexbox post 2009 to work
iOS 7.1-8.4 Chrome v21-28 Safari 6.1-8
I’ve been pulling my hair out over the weekend and today trying to isolate the issue and this is where I’ve come to.
Input CSS
.flex-test {
display: flex;
flex-wrap: wrap-reverse;
justify-content: space-between;
width: 100%;
}
.flex-text .child {
flex: 1;
}
.flex-text .child.noflex {
flex: none;
}
Autoprefixer configuration
autoprefixer({
browsers: ['> 1%', 'last 3 versions', 'Firefox >= 20', 'iOS >=7']
})
Output with above config (including 2009 flexbox model)
.flex-test {
display:-webkit-box;
display:-ms-flexbox;
display:flex;
-ms-flex-wrap:wrap-reverse;
flex-wrap:wrap-reverse;
-webkit-box-pack:justify;
-ms-flex-pack:justify;
justify-content:space-between;
width:100%
}
.flex-text .child {
-webkit-box-flex:1;
-ms-flex:1;
flex:1
}
.flex-text .child.noflex {
-webkit-box-flex:0;
-ms-flex:none;
flex:none
}
Output with above config & “no-2009” flag
.flex-test {
display:-ms-flexbox;
display:flex;
-ms-flex-wrap:wrap-reverse;
flex-wrap:wrap-reverse;
-ms-flex-pack:justify;
justify-content:space-between;
width:100%
}
.flex-text .child {
-ms-flex:1;
flex:1
}
.flex-text .child.noflex {
-ms-flex:none;
flex:none
}
What we’re expecting (with “no-2009” flag)
.flex-test {
display:-ms-flexbox;
display:-webkit-flex;
display:flex;
-ms-flex-wrap:wrap-reverse;
-webkit-flex-wrap:wrap-reverse;
flex-wrap:wrap-reverse;
-ms-flex-pack:justify;
-webkit-justify-content:space-between;
justify-content:space-between;
width:100%
}
.flex-text .child {
-ms-flex:1;
-webkit-flex:1;
flex:1
}
.flex-text .child.noflex {
-ms-flex:none;
-webkit-flex:none;
flex:none
}
Any help resolving this would be greatly appreciated.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:8 (4 by maintainers)
Top Results From Across the Web
gulp-autoprefixer not outputting -webkit-flex no matter the ...
Solved this by adding a browserslist config file. EDIT: At the time that I initially solved this, using the browserslist config suggested in ......
Read more >Autoprefixer: A Postprocessor for Dealing with Vendor ...
Autoprefixer parses CSS files and adds vendor prefixes to CSS rules using the Can I Use database to determine which prefixes are needed....
Read more >Autoprefixer - Best of JS
PostCSS plugin to parse CSS and add vendor prefixes to CSS rules using values from Can I Use. It is recommended by Google...
Read more >Backwards compatibility of flexbox - CSS - MDN Web Docs
Autoprefixer Online is a useful way to see which prefixes are recommended, depending on how many versions you wish to go back with...
Read more >Sage 8.5 -webkit-prefix- being stripped from output - Roots Discourse
No matter what I add in the browser list for autoprefixer, the CSS never has -webkit-flex. It even gets stripped out if I...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think problem is related with bad practice of setting browsers via option. Please use
browserslist
config orbrowserslist
key inpackage.json
as we recommend — at result you will have same browsers between all frontend tools.Yep totally the configuration. So our project made use of a package called
gulp-autoprefixer
which was a carry-over from another project. Ditched that and replaced it with plainautoprefixer
+gulp-postcss
ala the instructions in the readme. Moved the browsers configuration over to the package.json. Bingo all works. Thanks @ai, much appreciated.