Skip to content

Commit a2712ac

Browse files
authored
docs: add story about autoprefixer config
Those wishing to change which browsers are targeted for when css is prefixed can do so with a simple addition to their package.json file
1 parent 0633130 commit a2712ac

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Change target browsers for Autoprefixer
2+
3+
Currently, the CLI uses [Autoprefixer](https://github.com/postcss/autoprefixer) to ensure compatibility
4+
with different browser and browser versions. You may find it necessary to target specific browsers
5+
or exclude certain browser versions from your build.
6+
7+
Internally, Autoprefixer relies on a library called [Browserslist](https://github.com/ai/browserslist)
8+
to figure out which browsers to support with prefixing.
9+
10+
To set a custom browserlist config, add the following to your `package.json` file:
11+
12+
```
13+
"browserslist": [
14+
"> 1%",
15+
"last 2 versions"
16+
]
17+
```
18+
Autoprefixer will look for the `browserlist` property and array of targets to use when it prefixes your css.
19+
Check out the [browserslist repo](https://github.com/ai/browserslist) for more examples of how to target
20+
specific browsers and versions.
21+
22+
_Side note:_
23+
Those who are seeking to produce a [progressive web app](https://developers.google.com/web/progressive-web-apps/) and are using [Lighthouse](https://developers.google.com/web/tools/lighthouse/) to grade the project will
24+
need to add the following browserslist config to their package.json file to eliminate the [old flexbox](https://developers.google.com/web/tools/lighthouse/audits/old-flexbox) prefixes:
25+
```
26+
"browserslist": [
27+
"last 2 versions",
28+
"not ie <= 10",
29+
"not ie_mob <= 10"
30+
]
31+
```

0 commit comments

Comments
 (0)