Skip to content

Commit

Permalink
docs: update customize theme docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Sep 18, 2018
1 parent 27357d5 commit c4c75ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/vue/customize-theme.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module.exports = {
Another approach to customize theme is creating a `less` file within variables to override `antd.less`.

```css
@import "~antd/dist/antd.less"; // Import Ant Design styles by less entry
@import "~ant-design-vue/dist/antd.less"; // Import Ant Design Vue styles by less entry
@import "your-theme-file.less"; // variables to override above
```

Expand All @@ -138,9 +138,9 @@ While there's no canonical way to do it, you can take one of the following paths
It's possible to configure webpack to load an alternate less file:

```ts
new webpack.NormalModuleReplacementPlugin( /node_modules\/antd\/lib\/style\/index\.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
new webpack.NormalModuleReplacementPlugin( /node_modules\/ant-design-vue\/lib\/style\/index\.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )

#antd { @import '~antd/lib/style/core/index.less'; @import '~antd/lib/style/themes/default.less'; }
#antd { @import '~ant-design-vue/lib/style/core/index.less'; @import '~ant-design-vue/lib/style/themes/default.less'; }
```

Where the src/myStylesReplacement.less file loads the same files as the index.less file, but loads them within the scope of a top-level selector : the result is that all of the "global" styles are being applied with the #antd scope.
Expand All @@ -154,7 +154,7 @@ See an example of usage with gulp and [postcss-prefixwrap](https://github.com/db
You must import styles as less format. A common mistake would be importing multiple copied of styles that some of them are css format to override the less styles.

- If you import styles by specifying the `style` option of [babel-plugin-import](https://github.com/ant-design/babel-plugin-import), change it from `'css'` to `true`, which will import the `less` version of antd.
- If you import styles from `'antd/dist/antd.css'`, change it to `antd/dist/antd.less`.
- If you import styles from `'ant-design-vue/dist/antd.css'`, change it to `ant-design-vue/dist/antd.less`.

## Related Articles

Expand Down
4 changes: 2 additions & 2 deletions docs/vue/customize-theme.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module.exports = {
另外一种方式是建立一个单独的 `less` 变量文件,引入这个文件覆盖 `antd.less` 里的变量。

```css
@import "~antd/dist/antd.less"; // 引入官方提供的 less 样式入口文件
@import "~ant-design-vue/dist/antd.less"; // 引入官方提供的 less 样式入口文件
@import "your-theme-file.less"; // 用于覆盖上面定义的变量
```

Expand All @@ -133,7 +133,7 @@ module.exports = {
注意样式必须加载 less 格式,一个常见的问题就是引入了多份样式,less 的样式被 css 的样式覆盖了。

- 如果你在使用 [babel-plugin-import](https://github.com/ant-design/babel-plugin-import) 的 `style` 配置来引入样式,需要将配置值从 `'css'` 改为 `true`,这样会引入 less 文件。
- 如果你是通过 `'antd/dist/antd.css'` 引入样式的,改为 `antd/dist/antd.less`。
- 如果你是通过 `'ant-design-vue/dist/antd.css'` 引入样式的,改为 `ant-design-vue/dist/antd.less`。

## 社区教程 for Antd React

Expand Down

0 comments on commit c4c75ba

Please sign in to comment.