plugin.config.js 843 字节
Newer Older
陈帅 已提交
1 2
// Change theme plugin

愚道 已提交
3 4 5
import MergeLessPlugin from 'antd-pro-merge-less';
import AntDesignThemePlugin from 'antd-pro-theme-webpack-plugin';
import path from 'path';
陈帅 已提交
6

愚道 已提交
7
export default config => {
陈帅 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
  // 将所有 less 合并为一个供 themePlugin使用
  const outFile = path.join(__dirname, '../.temp/ant-design-pro.less');
  const stylesDir = path.join(__dirname, '../src/');

  config.plugin('merge-less').use(MergeLessPlugin, [
    {
      stylesDir,
      outFile,
    },
  ]);

  config.plugin('ant-design-theme').use(AntDesignThemePlugin, [
    {
      antDir: path.join(__dirname, '../node_modules/antd'),
      stylesDir,
      varFile: path.join(__dirname, '../node_modules/antd/lib/style/themes/default.less'),
陈帅 已提交
24
      mainLessFile: outFile, //     themeVariables: ['@primary-color'],
陈帅 已提交
25 26 27 28
      indexFileName: 'index.html',
    },
  ]);
};