Commit 8f4c3f6f authored by 陈帅's avatar 陈帅

fix change theme plugin

parent 56dba6c0
......@@ -2,12 +2,15 @@
// https://umijs.org/config/
const pageRoutes = require('./router.config');
const webpackplugin = require('./plugin.config');
const path = require('path');
export default {
// add for transfer to umi
plugins: [
['umi-plugin-react', {
[
'umi-plugin-react',
{
antd: true,
dva: {
hmr: true,
......@@ -17,13 +20,9 @@ export default {
default: 'zh-CN', // default zh-CN
baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default
},
dll: [
'dva',
'dva/router',
'dva/saga',
'dva/fetch',
dll: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
},
],
}],
],
// 路由配置
routes: pageRoutes,
......@@ -82,29 +81,5 @@ export default {
],
},
chainWebpack(config) {
const AntDesignThemePlugin = require('antd-theme-webpack-plugin');
const MergeLessPlugin = require('antd-pro-merge-less');
// 将所有 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'),
// mainLessFile: outFile,
// themeVariables: ['@primary-color'],
// indexFileName: 'index.html',
// }]);
},
chainWebpack: webpackplugin,
};
// Change theme plugin
const MergeLessPlugin = require('antd-pro-merge-less');
const AntDesignThemePlugin = require('antd-theme-webpack-plugin');
const path = require('path');
const plugin = config => {
// 将所有 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'),
mainLessFile: outFile,
themeVariables: ['@primary-color'],
indexFileName: 'index.html',
},
]);
};
module.exports = plugin;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment