plugin.config.js 839 Bytes
Newer Older
陈帅's avatar
陈帅 committed
1 2
// Change theme plugin

愚道's avatar
愚道 committed
3
import MergeLessPlugin from 'antd-pro-merge-less';
陈帅's avatar
陈帅 committed
4
import AntDesignThemePlugin from 'antd-theme-webpack-plugin';
愚道's avatar
愚道 committed
5
import path from 'path';
陈帅's avatar
陈帅 committed
6

愚道's avatar
愚道 committed
7
export default config => {
陈帅's avatar
陈帅 committed
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'),
陈帅's avatar
陈帅 committed
24
      mainLessFile: outFile, //     themeVariables: ['@primary-color'],
陈帅's avatar
陈帅 committed
25 26 27 28
      indexFileName: 'index.html',
    },
  ]);
};