This release uses Browserslist 1.5 and is focused on sharing browsers with babel-preset-env and create-react-app.
package.json
We know that many developers hate the current mess of config files in the project root.
With Autoprefixer 6.6 you can specify browsers in package.json
to reduce config files:
{
"private": true,
"devDependencies": {
"autoprefixer": "^6.6.0",
"postcss": "^5.2.6"
},
"browserslist": [
"last 2 versions",
"ie 9"
]
}
Note that we highly recommend specifying browsers in browserslist
config or in package.json
instead of Autoprefixer option. In this case many other tools will share browsers list, including Stylelint and babel-env-preset.
Environments
In most cases, you should use same browsers list for Autoprefixer in development and production. But right now Autoprefixer share browsers list with many other tools including babel-env-preset.
To improve development performance developers might want to use different target browsers in development.
So both Browserslist config now supports environments:
[development]
last 1 version
[production]
last 2 version
> 1%
"private": true,
"devDependencies": {
"autoprefixer": "^6.6.0",
"postcss": "^5.2.6"
},
"browserslist": {
"development": [
"last 1 version"
],
"production": [
"last 2 version",
"> 1%"
]
}
Autoprefixer will use env
option, BROWSERSLIST_ENV
or NODE_ENV
to detect current environment.
Custom Browser Statistics
In addition to > 1%
and > 1% in US
, Browserslist supports > 1% in my stats
to select popular versions according your visitors statistics.
To do it you need save JSON data from Google Analytics.
Autoprefixer 6.6 support standard name for this usage data file browserslist-stats.json
and will load it automatically, without need to pass stats
options.
It is especially useful if you share browsers with other tools without stats
option support.