I am trying to configure antd theme in react-boilerplate. I saw the issue 2027 in react-boilerplate repo. This is exactly what I want but I tried the given configuration in the accepted answer and it doesn't work for me.
In vanilla react-boilerplate repo, I installed antd. In the HomePage (index.js), I added a button, checkbox as
<Button type="primary">Primary</Button>
<Checkbox onChange={onChange}>Checkbox</Checkbox>
My webpack.base.babel.js
looks like
const path = require('path');
const fs = require('fs');
const lessToJs = require('less-vars-to-js');
const themeVariables = lessToJs(fs.readFileSync(path.join(__dirname, './../../app/theme.less'), 'utf8'));
and one of the rule is
{
test: /\.less$/,
include: /node_modules/,
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
modifyVars: themeVariables,
},
},
],
},
The theme.less
file is
@ant-prefix: ant;
@primary-color: #ff0000;
@btn-primary-color: #ff0000;
@checkbox-color: #ff0000;
@checkbox-check-color: #ff0000;
I tried overriding any possible colour in Button or Checkbox but couldn't get the theme colour changed.
Is there something I am missing? I have been stuck at this point from a long time. Any suggestion would be of great help.