docs: update customize theme docs
							parent
							
								
									27357d5fed
								
							
						
					
					
						commit
						c4c75bab0f
					
				|  | @ -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 | ||||
| ``` | ||||
| 
 | ||||
|  | @ -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. | ||||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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";   // 用于覆盖上面定义的变量 | ||||
| ``` | ||||
| 
 | ||||
|  | @ -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 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 tangjinzhou
						tangjinzhou