Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ant Design全局改变主题色 #1

Open
machao07 opened this issue Feb 15, 2021 · 0 comments
Open

Ant Design全局改变主题色 #1

machao07 opened this issue Feb 15, 2021 · 0 comments

Comments

@machao07
Copy link
Owner

machao07 commented Feb 15, 2021

1、安装[email protected]

/* package.json */
"scripts": {
-   "start": "react-scripts start",
-   "build": "react-scripts build",
-   "test": "react-scripts test",
+   "start": "craco start",
+   "build": "craco build",
+   "test": "craco test",
}

2、安装craco-less

yarn add craco-less

将index.js文件 antd.css改成 .less

- @import '~antd/dist/antd.css';
+ @import '~antd/dist/antd.less';

3、覆盖原有配置

新建craco.config.js文件,重启项目

const CracoLessPlugin = require('craco-less');
module.exports = {
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: { '@primary-color': '#1DA57A' },
            javascriptEnabled: true,
          },
        },
      },
    },
  ],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant