deansatch's avatar

Bootstrap 4 scss with autoprefixer missing -ms-flex-wrap

I have a new project using bootstrap 4 scss. I have autoprefixer running in my webpack.mix.js:


mix.react("resources/js/app.js", "public/js")
    .sass("resources/sass/app.scss", "public/css")
    .options({
        postCss: [
            require("autoprefixer")({
                browsers: [
                    "last 1 major version",
                    ">= 1%",
                    "Chrome >= 45",
                    "Firefox >= 38",
                    "Edge >= 12",
                    "Explorer >= 10",
                    "iOS >= 9",
                    "Safari >= 9",
                    "Android >= 4.4",
                    "Opera >= 30"
                ]
            })
        ]
    });

It is prefixing -ms-flexbox but I still have a broken layout. When I compare it to the cdn version of bootstrap .css I notice that -ms-flex-wrap is missing from my compiled version but it is in their cdn version. Any ideas how to get mine to compile the same?

0 likes
11 replies
deansatch's avatar

It seems like it is actually removing it…not just failing to add it. Instead of importing bootstrap.scss into my app.scss file, I imported the dist/css/bootstrap.min.css instead. I checked the file and it has -ms-flex-wrap in there. After my scss compiles my app.css file has everything except -ms-flex-wrap

Any ideas?

deansatch's avatar

@JSENGER - any way to stop it ignoring it? It is needed for IE10. I do specify IE10 in the browser list but it makes no difference

STEREOH's avatar

from https://github.com/postcss/autoprefixer

Available options are: ...

  • flexbox (boolean|string): should Autoprefixer add prefixes for flexbox properties. With "no-2009" value Autoprefixer will add prefixes only for final and IE 10 versions of specification. Default is true. ...

Maybe it can help

deansatch's avatar

@JSENGER - no, that's the problem. It actually removes it from my css. i.e. it is already there in my bootstrap.min.css file, but after compiling all to app.css it is missing. It also states on caniuse that it still needs the prefix for IE10

jsenger's avatar

Just tried it myself and added the prefixed one to a rule and it worked.

Did you assign -ms-flex-wrap directly after flex-wrap?

deansatch's avatar

@JSENGER - well since it concerns the bootstrap.min.css I have to rely on how they have done it. Looks like they have -ms-flex-wrap, then flex-wrap. So that explains why it strips it out for that file.

But, why is it ignoring my browsers? It should leave it alone if i specify IE10. I've tried setting it to "last 10 versions" but still the same result. Bootstrap actually say they use autoprefixer to generate their .css version so it should work

deansatch's avatar

Ok I solved this by removing the browsers from my webpack.mix.js and downloaded browserslist then added the list to my package.json file. No idea why webpack.mix.js was ignoring the options though

jsenger's avatar

Strange... but I'm glad that it's working for you now.

Please or to participate in this conversation.