@ -22,8 +22,8 @@ There are some major variables below, all less variables could be found in [Defa
@font -size-base: 14px; // major text font size
@font -size-base: 14px; // major text font size
@heading -color: rgba(0, 0, 0, 0.85); // heading text color
@heading -color: rgba(0, 0, 0, 0.85); // heading text color
@text -color: rgba(0, 0, 0, 0.65); // major text color
@text -color: rgba(0, 0, 0, 0.65); // major text color
@text -color-secondary : rgba(0, 0, 0, .45); // secondary text color
@text -color-secondary: rgba(0, 0, 0, 0 .45); // secondary text color
@disabled -color : rgba(0, 0, 0, .25); // disable state color
@disabled -color: rgba(0, 0, 0, 0 .25); // disable state color
@border -radius-base: 4px; // major border radius
@border -radius-base: 4px; // major border radius
@border -color-base: #d9d9d9 ; // major border color
@border -color-base: #d9d9d9 ; // major border color
@box -shadow-base: 0 2px 8px rgba(0, 0, 0, 0.15); // major shadow for layers
@box -shadow-base: 0 2px 8px rgba(0, 0, 0, 0.15); // major shadow for layers
@ -112,18 +112,8 @@ include `antd/dist/antd-dark.less` in the style file:
Another approach to using [less-loader ](https://github.com/webpack-contrib/less-loader ) in `webpack.config.js` to introduce as needed:
Another approach to using [less-loader ](https://github.com/webpack-contrib/less-loader ) in `webpack.config.js` to introduce as needed:
```js
````js
const lessToJs = require('less-vars-to-js');
const darkThemeVars = require('antd/dist/antd-dark');
const fs = require('fs');
const colorLess = fs.readFileSync(require.resolve('antd/lib/style/color/colors.less'), 'utf8');
const defaultLess = fs.readFileSync(require.resolve('antd/lib/style/themes/default.less'), 'utf8');
const darkLess = fs.readFileSync(require.resolve('antd/lib/style/themes/dark.less'), 'utf8');
const darkThemeVars = lessToJs(`${colorLess}${defaultLess}${darkLess}`, {
resolveVariables: false,
stripPrefix: false,
})
// webpack.config.js
// webpack.config.js
module.exports = {
module.exports = {
@ -159,7 +149,7 @@ It's possible to configure webpack to load an alternate less file:
new webpack.NormalModuleReplacementPlugin( /node_modules\/antd\/lib\/style\/index\.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
new webpack.NormalModuleReplacementPlugin( /node_modules\/antd\/lib\/style\/index\.less/, path.resolve(rootDir, 'src/myStylesReplacement.less') )
#antd { @import '~antd/es/style/core/index.less'; @import '~antd/es/style/themes/default.less'; }
#antd { @import '~antd/es/style/core/index.less'; @import '~antd/es/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.
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.