plugin.config.js 843 Bytes
Newer Older
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
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';
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
6

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',
    },
  ]);
};