zefeng
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
0 deletions
-
docs/react/customize-theme.en-US.md
-
docs/react/customize-theme.zh-CN.md
|
@ -182,6 +182,7 @@ If the project does not use Less, you can import [antd.dark.css](https://unpkg.c |
|
|
Method 3: using [less-loader](https://github.com/webpack-contrib/less-loader) in `webpack.config.js` to introduce as needed: |
|
|
Method 3: using [less-loader](https://github.com/webpack-contrib/less-loader) in `webpack.config.js` to introduce as needed: |
|
|
|
|
|
|
|
|
```diff |
|
|
```diff |
|
|
|
|
|
const defaultTheme = require('antd/dist/default-theme'); |
|
|
const darkTheme = require('antd/dist/dark-theme'); |
|
|
const darkTheme = require('antd/dist/dark-theme'); |
|
|
const compactTheme = require('antd/dist/compact-theme'); |
|
|
const compactTheme = require('antd/dist/compact-theme'); |
|
|
|
|
|
|
|
@ -198,6 +199,7 @@ module.exports = { |
|
|
+ options: { |
|
|
+ options: { |
|
|
+ modifyVars: { |
|
|
+ modifyVars: { |
|
|
+ 'hack': `true;@import "${require.resolve('antd/lib/style/color/colorPalette.less')}";`, |
|
|
+ 'hack': `true;@import "${require.resolve('antd/lib/style/color/colorPalette.less')}";`, |
|
|
|
|
|
+ ...defaultTheme, // darkTheme and compactTheme depend on defaultTheme |
|
|
+ ...darkTheme, |
|
|
+ ...darkTheme, |
|
|
+ ...compactTheme, |
|
|
+ ...compactTheme, |
|
|
+ }, |
|
|
+ }, |
|
|
|
@ -160,6 +160,7 @@ module.exports = { |
|
|
方式三:是用在 `webpack.config.js` 使用 [less-loader](https://github.com/webpack-contrib/less-loader) 按需引入: |
|
|
方式三:是用在 `webpack.config.js` 使用 [less-loader](https://github.com/webpack-contrib/less-loader) 按需引入: |
|
|
|
|
|
|
|
|
```diff |
|
|
```diff |
|
|
|
|
|
const defaultTheme = require('antd/dist/default-theme'); |
|
|
const darkTheme = require('antd/dist/dark-theme'); |
|
|
const darkTheme = require('antd/dist/dark-theme'); |
|
|
const compactTheme = require('antd/dist/compact-theme'); |
|
|
const compactTheme = require('antd/dist/compact-theme'); |
|
|
|
|
|
|
|
@ -176,6 +177,7 @@ module.exports = { |
|
|
+ options: { |
|
|
+ options: { |
|
|
+ modifyVars: { |
|
|
+ modifyVars: { |
|
|
+ 'hack': `true;@import "${require.resolve('antd/lib/style/color/colorPalette.less')}";`, |
|
|
+ 'hack': `true;@import "${require.resolve('antd/lib/style/color/colorPalette.less')}";`, |
|
|
|
|
|
+ ...defaultTheme, // darkTheme 和 compactTheme 依赖 defaultTheme |
|
|
+ ...darkTheme, |
|
|
+ ...darkTheme, |
|
|
+ ...compactTheme, |
|
|
+ ...compactTheme, |
|
|
+ }, |
|
|
+ }, |
|
|