PostCSS does not honor options passed to Autoprefixer
See original GitHub issue- Laravel Mix Version: 1.5.1
- Node Version: 8.5.0
- NPM Version: 5.4.2
- OS: OS X El Capitan v10.11.5
Description:
Attempting to pass custom options to Autoprefixer through the postCss
array appears to do nothing.
Custom options may be necessary when dealing with cross-device / cross-browser QA on common frontend frameworks like Bootstrap.
Steps To Reproduce:
package.json
{
"private": true,
"scripts": {
"dev": "./node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"bootstrap": "^4.0.0-alpha.6",
"laravel-mix": "^1.0"
}
}
webpack.mix.js
let mix = require('laravel-mix');
mix.sass('assets/scss/main.scss', 'public/css');
mix.sass('assets/scss/main2.scss', 'public/css').options({
postCss: [
require('autoprefixer')({
browsers: [
'last 2 versions',
'iOS >= 8',
'Safari >= 8',
],
cascade: false,
flexbox: "no-2009"
}),
]
});
assets/main.scss
@import '~bootstrap/scss/bootstrap';
assets/main2.scss
@import '~bootstrap/scss/bootstrap';
Then run npm run dev
.
Note that the output of public/css/main.css
and public/css/main2.css
are identical.
Hardcoding in some options on line 160 of /src/builder/webpack-rules.js
will yield the desired results. Differences can be found by turning off one of the sass tasks and running the build with hardcoded options in place:
plugins.push(require('autoprefixer')({
browsers: [
'last 2 versions',
'iOS >= 8',
'Safari >= 8',
],
cascade: false,
flexbox: "no-2009"
}));
Is there something I could be missing? Is there a place I can pass in Autoprefixer options without altering source code?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Thanks @AndreasElia and great job @JeffreyWay !
@maiorano84 did you solve this issue?