Skip to content

webpack antd主题配置

yezihaohao edited this page Feb 13, 2018 · 1 revision

关于项目中antd的主题配置

  1. 找到antd安装目录源码样式变量文件node_modules\antd\es\style\themes\default.less(可以先找到需要定制的模块,查询其使用的样式基础变量,改起来更方便)。
  2. 在项目根目录的theme\index.json的文件中,添加步骤1文件中的变量,以json key-value的形式将其覆盖。
  3. 关于变量生效:在webpack.config.dev.js & webpack.config.prod.js两个配置文件中在增加以下代码:
const theme = require('../theme');

{
   loader: require.resolve('less-loader'),
   options: {
      + modifyVars: theme,
     },
},
Clone this wiki locally