ant-design / ant-design-dark-theme

🌚 Dark theme variables of Ant Design
https://www.antdtheme.com/dark
MIT License
483 stars 34 forks source link

config-overrides.js 中直接配置darkTheme无法生效 #19

Closed Altamill closed 4 years ago

Altamill commented 4 years ago

`const { override, fixBabelImports, addLessLoader, } = require("customize-cra");

const darkTheme = require("@ant-design/dark-theme");

process.env.GENERATE_SOURCEMAP = "false"; //打包时去除map文件 module.exports = override( fixBabelImports("import", { libraryName: "antd", libraryDirectory: "es", style: true // change importing css to less }), addLessLoader({ javascriptEnabled: true, modifyVars: darkTheme }) );`

chenshuai2144 commented 4 years ago

config-overrides 是什么东西?

Altamill commented 4 years ago

https://ant.design/docs/react/use-with-create-react-app-cn 此链接中的高级配置项下有详细说明这个文件的用处,个人理解应该是用来按需加载样式用的。

afc163 commented 4 years ago
- const darkTheme = require("@ant-design/dark-theme");
+ const darkTheme = require("@ant-design/dark-theme").default;

Try it.

afc163 commented 4 years ago

或者 console.log(darkTheme) 看看是啥。

Altamill commented 4 years ago

console.log(darkTheme)是@ant-design dark-theme 目录下 inde.js 文件中的样式

Altamill commented 4 years ago

const darkTheme = require("@ant-design/dark-theme").default; 更改之后只有部分样式被覆盖,字体以及按钮等其他样式还是原来的 image

afc163 commented 4 years ago
image

@ant-design/dark-theme 还不完善,欢迎给我们 PR。