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

fix change theme plugin

parent 56dba6c0
...@@ -2,28 +2,27 @@ ...@@ -2,28 +2,27 @@
// https://umijs.org/config/ // https://umijs.org/config/
const pageRoutes = require('./router.config'); const pageRoutes = require('./router.config');
const webpackplugin = require('./plugin.config');
const path = require('path'); const path = require('path');
export default { export default {
// add for transfer to umi // add for transfer to umi
plugins: [ plugins: [
['umi-plugin-react', { [
antd: true, 'umi-plugin-react',
dva: { {
hmr: true, antd: true,
}, dva: {
locale: { hmr: true,
enable: true, // default false },
default: 'zh-CN', // default zh-CN locale: {
baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default enable: true, // default false
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, routes: pageRoutes,
...@@ -82,29 +81,5 @@ export default { ...@@ -82,29 +81,5 @@ export default {
], ],
}, },
chainWebpack(config) { chainWebpack: webpackplugin,
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',
// }]);
},
}; };
// 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