WEB Tips デザイン・コーディング

AutoprefixerのバージョンアップでReplace Autoprefixer browsers option to Browserslist config.メッセージの対応

2019-08-13

本記事にはプロモーションが含まれています。

AutoprefixerのバージョンアップでReplace Autoprefixer browsers option to Browserslist config.メッセージの対応

gulpを立ち上げたときに以下のようなメッセージ。

Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option cause some error. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist

Autoprefixerのバージョンアップで、今までgulpfile.jsに記述していた対象ブラウザをpackage.jsonに書き換える必要があります。

gulpfile.jsに記載されているautoprefixerのbrowsers:~の部分をコメントアウトか削除します。

autoprefixer({ browsers: ['last 2 versions', 'ie >= 9'] })

package.jsonに追記します。

"browserslist": [
  "last 2 version",
  "> 5%",
  "ie >= 9"
]

https://github.com/browserslist/browserslist#readme

これでメッセージは解消しました。

-WEB Tips, デザイン・コーディング