Skip to content
Merged
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
13 changes: 12 additions & 1 deletion src/sites/sites-react/doc/docs/react/start-react.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,18 @@ babel config:
## Usage Notes

- NutUI-React is built on top of [react@^18.0.0](https://www.npmjs.com/package/react)
- The CSS units used in the components are px. If your project requires rem units, you can use some tools for conversion, such as [webpack](https://www.webpackjs.com/) with the [px2rem-loader](https://www.npmjs.com/package/px2rem-loader), or the [postcss](https://github.com/postcss/postcss) plugin [postcss-plugin-px2rem](https://www.npmjs.com/package/postcss-plugin-px2rem).
- The CSS units used in the components are px. If your project requires rem units, you can use some tools for conversion, such as [webpack](https://www.webpackjs.com/) with the [px2rem-loader](https://www.npmjs.com/package/px2rem-loader), or the [postcss](https://github.com/postcss/postcss) plugin [postcss-plugin-px2rem](https://www.npmjs.com/package/postcss-plugin-px2rem). Be attention, when you want to change **px** to **rem**, you should set classnames about **NutUI** in the black list, such as:

```
module.exports = {
plugins: {
'postcss-pxtorem': {
propList: ['*'],
selectorBlackList: ['nut-'] // ignore items
}
}
}
```

## Templates

Expand Down
13 changes: 12 additions & 1 deletion src/sites/sites-react/doc/docs/react/start-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,18 @@ babel 配置:
## 使用注意事项

- NutUI-React 基于 [react@^18.0.0](https://www.npmjs.com/package/react) 构建
- 组件 CSS 单位使用的是 **px**,如果你的项目中需要 **rem** 单位,可借助一些工具进行转换,比如 [webpack](https://www.webpackjs.com/) 的 [px2rem-loader](https://www.npmjs.com/package/px2rem-loader)、[postcss](https://github.com/postcss/postcss) 的 [postcss-plugin-px2rem](https://www.npmjs.com/package/postcss-plugin-px2rem) 插件等
- 组件 CSS 单位使用的是 **px**,如果你的项目中需要 **rem** 单位,可借助一些工具进行转换,比如 [webpack](https://www.webpackjs.com/) 的 [px2rem-loader](https://www.npmjs.com/package/px2rem-loader)、[postcss](https://github.com/postcss/postcss) 的 [postcss-plugin-px2rem](https://www.npmjs.com/package/postcss-plugin-px2rem) 插件等。需要注意的是,在转化 **rem** 时,对 **NutUI** 相关的样式设置在黑名单里,如:

```
module.exports = {
plugins: {
'postcss-pxtorem': {
propList: ['*'],
selectorBlackList: ['nut-'] // 忽略类名
}
}
}
```

## 示例

Expand Down
20 changes: 20 additions & 0 deletions src/sites/sites-react/doc/docs/taro/start-react.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,23 @@ config = {
```

:::

#### 4、CSS units

The CSS units used in the components are px. However, during the Taro compilation, Taro will help you perform size conversion operations on styles. It is important to note that you should add styles related to NutUI to the blacklist, such as:

:::demo

```js
// config/index.js
config = {
postcss: {
pxtransform: {
enable: true,
config: { selectorBlackList: ['nut-'] },
},
},
}
```

:::
21 changes: 21 additions & 0 deletions src/sites/sites-react/doc/docs/taro/start-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,24 @@ config = {
```

:::

#### 4、样式单位转化

组件 CSS 单位使用的是 **px**,但是在 `Taro` 编译时,Taro 会帮你对样式做尺寸转换操作,需要注意的是,要对 **NutUI** 相关的样式设置在黑名单里,如:

:::demo

```js
// config/index.js
config = {
postcss: {
pxtransform: {
enable: true,
// 包含 `nut-` 的类名选择器中的 px 单位不会被解析
config: { selectorBlackList: ['nut-'] },
},
},
}
```

:::