美文网首页angular
改变目标浏览器的自动前缀

改变目标浏览器的自动前缀

作者: 王义杰 | 来源:发表于2018-06-08 15:02 被阅读9次

Change target browsers for Autoprefixer

改变目标浏览器的自动前缀

Currently, the CLI uses Autoprefixer to ensure compatibility
with different browser and browser versions. You may find it necessary to target specific browsers
or exclude certain browser versions from your build.
当前, CLI使用 Autoprefixer 来确定合适不同的浏览器和版本,你可以发现它必须指明特定的浏览器或不包括某个浏览器版本从你的构建。

Internally, Autoprefixer relies on a library called Browserslist
to figure out which browsers to support with prefixing.
在内部,自动前缀依赖一个库叫Browserslist 用来算出哪些浏览器支持前缀

There are a few ways to tell Autoprefixer what browsers to target:
这儿是一些方法告诉自动前缀目标浏览器:

Add a browserslist property to the package.json file

增加浏览器列表的特征到 package.json 文件

"browserslist": [
  "> 1%",
  "last 2 versions"
]

Add a new file to the project directory called .browserslistrc

增加一些文件到项目,目录叫 .browserslistrc

### Supported Browsers
### 支持的浏览器

> 1%
last 2 versions

Autoprefixer will look for the configuration file/property to use when it prefixes your css.
Check out the browserslist repo for more examples of how to target
specific browsers and versions.
自动前缀将寻找要使用的配置文件或属性,前缀是css. 检出browserslist repo 为怎样标记特定浏览器或ban'j的更多例子。

Side note:
Those who are seeking to produce a progressive web app and are using Lighthouse to grade the project will
need to add the following browserslist config to their package.json file to eliminate the old flexbox prefixes
便笺:
那些试图制作progressive web app 和使用grade项目将需要增加下列浏览器列表配置他们的package.json文件消除old flexbox前缀

package.json 配置:

"browserslist": [
  "last 2 versions",
  "not ie <= 10",
  "not ie_mob <= 10"
]

相关文章

  • 改变目标浏览器的自动前缀

    Change target browsers for Autoprefixer 改变目标浏览器的自动前缀 Curr...

  • Gulp

    自动给CSS加前缀 Autoprefixer CSS onlinefilter选择支持最近的几个浏览器版本/---...

  • PostCss笔记

    PostCss笔记 跨浏览器兼容性: 后处理 autoprefixer: 自动添加前缀 指定支持的浏览器版本 Au...

  • JavaScript 常用 loader的使用以及作用

    css类 1. postcss-loader 工具 自动补全浏览器前缀自动把px转为remcss 代码压缩使用下一...

  • webstorm使用Autoprefixer

    Autoprefixer 是处理浏览器前缀的后处理程序,可以实现css3代码自动补全前缀 实现步骤 1. 安装 n...

  • 学习纲要:常用样式

    学习目标 知道 这篇文章 列的属性,以及属性对应的常用的值。 知道浏览器前缀是什么和主流的浏览器前缀怎么写。 ps...

  • 2019-03-24弹性盒子

    一、 弹性盒子布局 CSS3自动实现浏览器兼容前缀插件:autoprefixer 参考地址:http://www....

  • gulp插件(9) - gulp-postcss & a

    功能描述 根据设置浏览器版本自动处理浏览器前缀。使用她我们可以很潇洒地写代码,不必考虑CSS针对浏览器的兼容性问题...

  • AutoPrefixer

    自动添加浏览器兼容前缀的插件。以VS Code为例:在应用商店里搜索扩展autoprefixer,如图: 点击安装...

  • 浏览器内核

    trident内核 IE浏览器 -ms-前缀 Gecko内核 Firefox浏览器 -moz-前缀 Webkit...

网友评论

    本文标题:改变目标浏览器的自动前缀

    本文链接:https://www.haomeiwen.com/subject/lsrasftx.html