Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add rem document #3440

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/en/development/rem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: rem 适配
---

# rem 适配

VUX项目使用`px`作为基本单位,如果您的项目中需要使用到`rem`单位,可以使用以下两个工具来转化

- [postcss-plugin-px2rem](https://github.com/pigcan/postcss-plugin-px2rem),PostCSS插件,用于从px生成rem
- [lib-flexible](https://github.com/amfe/lib-flexible),设置rem基准值

具体设置可以参考下面的代码
```js
module.exports = {
'plugins': {
// to edit target browsers: use "browserslist" field in package.json
'postcss-import': {},
'autoprefixer': {},
'postcss-plugin-px2rem': {
rootValue: 75, // 这里对应的是750的设计图尺寸
selectorBlackList: ['html'],
exclude: /node_modules|vux/i, // 过滤vux文件夹
propBlackList: ['border-radius', 'border'] // 不需要转化为rem的属性
}
}
}
```
3 changes: 3 additions & 0 deletions docs/src/summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ module.exports = [{
}, {
title: '禁用 eslint',
path: '/zh-CN/development/vue-loader-disable-eslint.html'
}, {
title: 'rem 适配',
path: '/zh-CN/development/rem.html'
}]
},
{
Expand Down
27 changes: 27 additions & 0 deletions docs/zh-CN/development/rem.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: rem 适配
---

# rem 适配

VUX项目使用`px`作为基本单位,如果您的项目中需要使用到`rem`单位,可以使用以下两个工具来转化

- [postcss-plugin-px2rem](https://github.com/pigcan/postcss-plugin-px2rem),PostCSS插件,用于从px生成rem
- [lib-flexible](https://github.com/amfe/lib-flexible),设置rem基准值

具体设置可以参考下面的代码
```js
module.exports = {
'plugins': {
// to edit target browsers: use "browserslist" field in package.json
'postcss-import': {},
'autoprefixer': {},
'postcss-plugin-px2rem': {
rootValue: 75, // 这里对应的是750的设计图尺寸
selectorBlackList: ['html'],
exclude: /node_modules|vux/i, // 过滤vux文件夹
propBlackList: ['border-radius', 'border'] // 不需要转化为rem的属性
}
}
}
```