[6a3a178] | 1 | # Browserslist [![Cult Of Martians][cult-img]][cult]
|
---|
| 2 |
|
---|
| 3 | <img width="120" height="120" alt="Browserslist logo by Anton Lovchikov"
|
---|
| 4 | src="https://browserslist.github.io/browserslist/logo.svg" align="right">
|
---|
| 5 |
|
---|
| 6 | The config to share target browsers and Node.js versions between different
|
---|
| 7 | front-end tools. It is used in:
|
---|
| 8 |
|
---|
| 9 | * [Autoprefixer]
|
---|
| 10 | * [Babel]
|
---|
| 11 | * [postcss-preset-env]
|
---|
| 12 | * [eslint-plugin-compat]
|
---|
| 13 | * [stylelint-no-unsupported-browser-features]
|
---|
| 14 | * [postcss-normalize]
|
---|
| 15 | * [obsolete-webpack-plugin]
|
---|
| 16 |
|
---|
| 17 | All tools will find target browsers automatically,
|
---|
| 18 | when you add the following to `package.json`:
|
---|
| 19 |
|
---|
| 20 | ```json
|
---|
| 21 | "browserslist": [
|
---|
| 22 | "defaults",
|
---|
| 23 | "not IE 11",
|
---|
| 24 | "maintained node versions"
|
---|
| 25 | ]
|
---|
| 26 | ```
|
---|
| 27 |
|
---|
| 28 | Or in `.browserslistrc` config:
|
---|
| 29 |
|
---|
| 30 | ```yaml
|
---|
| 31 | # Browsers that we support
|
---|
| 32 |
|
---|
| 33 | defaults
|
---|
| 34 | not IE 11
|
---|
| 35 | maintained node versions
|
---|
| 36 | ```
|
---|
| 37 |
|
---|
| 38 | Developers set their version lists using queries like `last 2 versions`
|
---|
| 39 | to be free from updating versions manually.
|
---|
| 40 | Browserslist will use [`caniuse-lite`] with [Can I Use] data for this queries.
|
---|
| 41 |
|
---|
| 42 | Browserslist will take queries from tool option,
|
---|
| 43 | `browserslist` config, `.browserslistrc` config,
|
---|
| 44 | `browserslist` section in `package.json` or environment variables.
|
---|
| 45 |
|
---|
| 46 | [cult-img]: https://cultofmartians.com/assets/badges/badge.svg
|
---|
| 47 | [cult]: https://cultofmartians.com/done.html
|
---|
| 48 |
|
---|
| 49 | <a href="https://evilmartians.com/?utm_source=browserslist">
|
---|
| 50 | <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
|
---|
| 51 | alt="Sponsored by Evil Martians" width="236" height="54">
|
---|
| 52 | </a>
|
---|
| 53 |
|
---|
| 54 | [stylelint-no-unsupported-browser-features]: https://github.com/ismay/stylelint-no-unsupported-browser-features
|
---|
| 55 | [eslint-plugin-compat]: https://github.com/amilajack/eslint-plugin-compat
|
---|
| 56 | [Browserslist Example]: https://github.com/browserslist/browserslist-example
|
---|
| 57 | [postcss-preset-env]: https://github.com/jonathantneal/postcss-preset-env
|
---|
| 58 | [postcss-normalize]: https://github.com/jonathantneal/postcss-normalize
|
---|
| 59 | [`caniuse-lite`]: https://github.com/ben-eb/caniuse-lite
|
---|
| 60 | [Autoprefixer]: https://github.com/postcss/autoprefixer
|
---|
| 61 | [Can I Use]: https://caniuse.com/
|
---|
| 62 | [Babel]: https://github.com/babel/babel/tree/master/packages/babel-preset-env
|
---|
| 63 | [obsolete-webpack-plugin]: https://github.com/ElemeFE/obsolete-webpack-plugin
|
---|
| 64 |
|
---|
| 65 | ## Docs
|
---|
| 66 | Read **[full docs](https://github.com/browserslist/browserslist#readme)** on GitHub.
|
---|