From 5e99cb1f95d1ec3190f436e2633baf007fcf22ee Mon Sep 17 00:00:00 2001 From: hz Date: Sat, 25 May 2019 22:20:47 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E9=AB=98=E6=80=A7=E8=83=BD=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E5=AE=9E=E7=8E=B0ant-design=E5=9C=A8=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E5=8A=A8=E6=80=81=E6=94=B9=E5=8F=98=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E8=89=B2=EF=BC=88=E5=88=A9=E7=94=A8webpack-theme-colo?= =?UTF-8?q?r-replacer=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/plugin.config.js | 41 +++++++++++++------ package.json | 3 +- .../SettingDrawer/themeColorClient.js | 27 ++++++++++++ src/models/setting.js | 8 ++++ 4 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 src/components/SettingDrawer/themeColorClient.js diff --git a/config/plugin.config.js b/config/plugin.config.js index 59ce550f..e57be8f8 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -1,7 +1,8 @@ // Change theme plugin import MergeLessPlugin from 'antd-pro-merge-less'; -import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; +// import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; +const ThemeColorReplacer = require('webpack-theme-color-replacer'); import path from 'path'; function getModulePackageName(module) { @@ -39,18 +40,21 @@ export default config => { 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', - generateOne: true, - lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js', - }, - ]); + config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [{ + fileName: 'css/theme-colors.css', + matchColors: getAntdSerials('#1890ff'), // 主色系列 + }]); + // 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', + // generateOne: true, + // lessUrl: 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js', + // }, + // ]); } // optimize chunks config.optimization @@ -81,3 +85,14 @@ export default config => { }, }); }; + +function getAntdSerials(color) { + const lightens = new Array(9).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.lighten(color, i / 10); + }); + // 此处为了简化,采用了darken。实际按color.less需求可以引入tinycolor, colorPalette变换得到颜色值 + const darkens = new Array(6).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.darken(color, i / 10); + }); + return lightens.concat(darkens); +} diff --git a/package.json b/package.json index 0704f91a..f45c87f7 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,8 @@ "resize-observer-polyfill": "^1.5.1", "umi": "^2.4.4", "umi-plugin-react": "^1.7.2", - "umi-request": "^1.0.5" + "umi-request": "^1.0.5", + "webpack-theme-color-replacer": "^1.1.3" }, "devDependencies": { "@types/history": "^4.7.2", diff --git a/src/components/SettingDrawer/themeColorClient.js b/src/components/SettingDrawer/themeColorClient.js new file mode 100644 index 00000000..9157c107 --- /dev/null +++ b/src/components/SettingDrawer/themeColorClient.js @@ -0,0 +1,27 @@ +const client = require('webpack-theme-color-replacer/client') + +export default { + primaryColor: '#1890ff', + getAntdSerials (color) { + // 淡化(即less的tint) + const lightens = new Array(9).fill().map((t, i) => { + return client.varyColor.lighten(color, i / 10) + }) + // 此处为了简化,采用了darken。实际按color.less需求可以引入tinycolor, colorPalette变换得到颜色值 + const darkens = new Array(6).fill().map((t, i) => { + return client.varyColor.darken(color, i / 10) + }) + return lightens.concat(darkens) + }, + changeColor (newColor) { + const lastColor = this.lastColor || this.primaryColor + const options = { + cssUrl: '/css/theme-colors.css', // hash模式下用相对路径 + oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors` + newColors: this.getAntdSerials(newColor || this.primaryColor) // new colors array, one-to-one corresponde with `oldColors` + } + const promise = client.changer.changeColor(options) + this.lastColor = lastColor + return promise + } +} diff --git a/src/models/setting.js b/src/models/setting.js index 3956ed3d..0ab74d90 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -1,6 +1,13 @@ import { message } from 'antd'; import defaultSettings from '../defaultSettings'; +import themeColorClient from '../components/SettingDrawer/themeColorClient' +const updateTheme = newPrimaryColor => { + const hideMessage = message.loading('正在切换主题!', 0) + themeColorClient.changeColor(newPrimaryColor) + .finally(() => hideMessage()) +} +/* let lessNodesAppended; const updateTheme = primaryColor => { // Don't compile less in production! @@ -59,6 +66,7 @@ const updateTheme = primaryColor => { buildIt(); } }; +*/ const updateColorWeak = colorWeak => { document.body.className = colorWeak ? 'colorWeak' : ''; From 25c42c38527aa31b1596cde3aa59a7c4a4a05b39 Mon Sep 17 00:00:00 2001 From: hz Date: Sun, 26 May 2019 12:31:29 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BD=BF=E7=94=A8@ant-design/colors?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=BB=E9=A2=98=E8=89=B2=E7=B3=BB=EF=BC=9B?= =?UTF-8?q?=E5=85=BC=E5=AE=B9IE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/plugin.config.js | 16 +++------------- package.json | 8 ++++---- .../SettingDrawer/themeColorClient.js | 17 ++++++----------- 3 files changed, 13 insertions(+), 28 deletions(-) diff --git a/config/plugin.config.js b/config/plugin.config.js index e57be8f8..4582fe2f 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -2,8 +2,9 @@ import MergeLessPlugin from 'antd-pro-merge-less'; // import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; -const ThemeColorReplacer = require('webpack-theme-color-replacer'); +import ThemeColorReplacer from 'webpack-theme-color-replacer'; import path from 'path'; +import generate from '@ant-design/colors/lib/generate'; function getModulePackageName(module) { if (!module.context) return null; @@ -42,7 +43,7 @@ export default config => { ]); config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [{ fileName: 'css/theme-colors.css', - matchColors: getAntdSerials('#1890ff'), // 主色系列 + matchColors: generate('#1890ff'), // 主色系列 }]); // config.plugin('ant-design-theme').use(AntDesignThemePlugin, [ // { @@ -85,14 +86,3 @@ export default config => { }, }); }; - -function getAntdSerials(color) { - const lightens = new Array(9).fill().map((t, i) => { - return ThemeColorReplacer.varyColor.lighten(color, i / 10); - }); - // 此处为了简化,采用了darken。实际按color.less需求可以引入tinycolor, colorPalette变换得到颜色值 - const darkens = new Array(6).fill().map((t, i) => { - return ThemeColorReplacer.varyColor.darken(color, i / 10); - }); - return lightens.concat(darkens); -} diff --git a/package.json b/package.json index f45c87f7..5684d8d7 100644 --- a/package.json +++ b/package.json @@ -82,15 +82,14 @@ "resize-observer-polyfill": "^1.5.1", "umi": "^2.4.4", "umi-plugin-react": "^1.7.2", - "umi-request": "^1.0.5", - "webpack-theme-color-replacer": "^1.1.3" + "umi-request": "^1.0.5" }, "devDependencies": { "@types/history": "^4.7.2", "@types/react": "^16.8.1", "@types/react-dom": "^16.0.11", "antd-pro-merge-less": "^1.0.0", - "antd-theme-webpack-plugin": "^1.2.0", + "@ant-design/colors": "^3.1.0", "babel-eslint": "^10.0.1", "chalk": "^2.4.2", "check-prettier": "^1.0.1", @@ -127,7 +126,8 @@ "tslint": "^5.12.1", "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", - "umi-plugin-ga": "^1.1.3" + "umi-plugin-ga": "^1.1.3", + "webpack-theme-color-replacer": "^1.1.4" }, "optionalDependencies": { "puppeteer": "^1.12.1" diff --git a/src/components/SettingDrawer/themeColorClient.js b/src/components/SettingDrawer/themeColorClient.js index 9157c107..9918122c 100644 --- a/src/components/SettingDrawer/themeColorClient.js +++ b/src/components/SettingDrawer/themeColorClient.js @@ -1,17 +1,11 @@ -const client = require('webpack-theme-color-replacer/client') +/* eslint-disable import/no-extraneous-dependencies */ +import generate from '@ant-design/colors/lib/generate'; +import client from 'webpack-theme-color-replacer/client' export default { primaryColor: '#1890ff', getAntdSerials (color) { - // 淡化(即less的tint) - const lightens = new Array(9).fill().map((t, i) => { - return client.varyColor.lighten(color, i / 10) - }) - // 此处为了简化,采用了darken。实际按color.less需求可以引入tinycolor, colorPalette变换得到颜色值 - const darkens = new Array(6).fill().map((t, i) => { - return client.varyColor.darken(color, i / 10) - }) - return lightens.concat(darkens) + return generate(color) }, changeColor (newColor) { const lastColor = this.lastColor || this.primaryColor @@ -20,8 +14,9 @@ export default { oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors` newColors: this.getAntdSerials(newColor || this.primaryColor) // new colors array, one-to-one corresponde with `oldColors` } - const promise = client.changer.changeColor(options) + const promise = client.changer.changeColor(options, Promise); this.lastColor = lastColor return promise } } + From c83a1d899a94c7dc4a3e8171c02e1c4f7ff5e01d Mon Sep 17 00:00:00 2001 From: hz Date: Sun, 26 May 2019 14:59:33 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E9=97=AE=E9=A2=98=EF=BC=9B=20npm=20run=20pre?= =?UTF-8?q?ttier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/plugin.config.js | 19 +++++++++++---- .../SettingDrawer/themeColorClient.js | 23 +++++++++---------- src/models/setting.js | 9 ++++---- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/config/plugin.config.js b/config/plugin.config.js index 4582fe2f..b8056c92 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -41,10 +41,21 @@ export default config => { outFile, }, ]); - config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [{ - fileName: 'css/theme-colors.css', - matchColors: generate('#1890ff'), // 主色系列 - }]); + config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [ + { + fileName: 'css/theme-colors.css', + matchColors: generate('#1890ff'), // 主色系列 + // 改变样式选择器,解决样式覆盖问题 + changeSelector(selector) { + switch (selector) { + case '.ant-calendar-today .ant-calendar-date': + return ':not(.ant-calendar-selected-day)' + selector; + default: + return selector; + } + }, + }, + ]); // config.plugin('ant-design-theme').use(AntDesignThemePlugin, [ // { // antDir: path.join(__dirname, '../node_modules/antd'), diff --git a/src/components/SettingDrawer/themeColorClient.js b/src/components/SettingDrawer/themeColorClient.js index 9918122c..9eeee6d7 100644 --- a/src/components/SettingDrawer/themeColorClient.js +++ b/src/components/SettingDrawer/themeColorClient.js @@ -1,22 +1,21 @@ /* eslint-disable import/no-extraneous-dependencies */ import generate from '@ant-design/colors/lib/generate'; -import client from 'webpack-theme-color-replacer/client' +import client from 'webpack-theme-color-replacer/client'; export default { primaryColor: '#1890ff', - getAntdSerials (color) { - return generate(color) + getAntdSerials(color) { + return generate(color); }, - changeColor (newColor) { - const lastColor = this.lastColor || this.primaryColor + changeColor(newColor) { + const lastColor = this.lastColor || this.primaryColor; const options = { cssUrl: '/css/theme-colors.css', // hash模式下用相对路径 oldColors: this.getAntdSerials(lastColor), // current colors array. The same as `matchColors` - newColors: this.getAntdSerials(newColor || this.primaryColor) // new colors array, one-to-one corresponde with `oldColors` - } + newColors: this.getAntdSerials(newColor || this.primaryColor), // new colors array, one-to-one corresponde with `oldColors` + }; const promise = client.changer.changeColor(options, Promise); - this.lastColor = lastColor - return promise - } -} - + this.lastColor = lastColor; + return promise; + }, +}; diff --git a/src/models/setting.js b/src/models/setting.js index 0ab74d90..bb4df715 100644 --- a/src/models/setting.js +++ b/src/models/setting.js @@ -1,12 +1,11 @@ import { message } from 'antd'; import defaultSettings from '../defaultSettings'; -import themeColorClient from '../components/SettingDrawer/themeColorClient' +import themeColorClient from '../components/SettingDrawer/themeColorClient'; const updateTheme = newPrimaryColor => { - const hideMessage = message.loading('正在切换主题!', 0) - themeColorClient.changeColor(newPrimaryColor) - .finally(() => hideMessage()) -} + const hideMessage = message.loading('正在切换主题!', 0); + themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage()); +}; /* let lessNodesAppended; const updateTheme = primaryColor => { From 867301ac9fcfe6cbff3d15fa49794b79d84ae25a Mon Sep 17 00:00:00 2001 From: hz Date: Sun, 26 May 2019 19:15:14 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E9=97=AE=E9=A2=98=EF=BC=9B=E8=A7=A3=E5=86=B3?= =?UTF-8?q?@keyframe=E5=86=85=E9=A2=9C=E8=89=B2=E6=9B=BF=E6=8D=A2=E6=97=A0?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/plugin.config.js | 30 ++++++++++++++----- package.json | 2 +- .../SettingDrawer/themeColorClient.js | 7 ++++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/config/plugin.config.js b/config/plugin.config.js index b8056c92..77a23dd5 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -44,15 +44,22 @@ export default config => { config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [ { fileName: 'css/theme-colors.css', - matchColors: generate('#1890ff'), // 主色系列 + matchColors: getAntdSerials('#1890ff'), // 主色系列 // 改变样式选择器,解决样式覆盖问题 changeSelector(selector) { - switch (selector) { - case '.ant-calendar-today .ant-calendar-date': - return ':not(.ant-calendar-selected-day)' + selector; - default: - return selector; - } + var fix = { + '.ant-calendar-today .ant-calendar-date': + ':not(.ant-calendar-selected-date)' + selector, + '.ant-btn:focus,.ant-btn:hover': selector + .split(',') + .map(s => s + ':not(.ant-btn-primary)') + .join(','), + '.ant-btn.active,.ant-btn:active': selector + .split(',') + .map(s => s + ':not(.ant-btn-primary)') + .join(','), + }; + return fix[selector] || selector; }, }, ]); @@ -97,3 +104,12 @@ export default config => { }, }); }; + +function getAntdSerials(color) { + const colorPalettes = generate(color); + // 淡化(即less的tint) + const lightens = new Array(9).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.lighten(color, i / 10); + }); + return colorPalettes.concat(lightens); +} diff --git a/package.json b/package.json index 5684d8d7..c50ec8b6 100644 --- a/package.json +++ b/package.json @@ -127,7 +127,7 @@ "tslint-config-prettier": "^1.17.0", "tslint-react": "^3.6.0", "umi-plugin-ga": "^1.1.3", - "webpack-theme-color-replacer": "^1.1.4" + "webpack-theme-color-replacer": "^1.1.5" }, "optionalDependencies": { "puppeteer": "^1.12.1" diff --git a/src/components/SettingDrawer/themeColorClient.js b/src/components/SettingDrawer/themeColorClient.js index 9eeee6d7..a0e476de 100644 --- a/src/components/SettingDrawer/themeColorClient.js +++ b/src/components/SettingDrawer/themeColorClient.js @@ -5,7 +5,12 @@ import client from 'webpack-theme-color-replacer/client'; export default { primaryColor: '#1890ff', getAntdSerials(color) { - return generate(color); + // 淡化(即less的tint) + const lightens = new Array(9).fill().map((t, i) => { + return client.varyColor.lighten(color, i / 10); + }); + const colorPalettes = generate(color); + return lightens.concat(colorPalettes); }, changeColor(newColor) { const lastColor = this.lastColor || this.primaryColor; From 2755b5144125f55da6957bff2283a0745dd64131 Mon Sep 17 00:00:00 2001 From: hz Date: Sun, 26 May 2019 20:36:59 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/plugin.config.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/config/plugin.config.js b/config/plugin.config.js index 77a23dd5..3801df6d 100644 --- a/config/plugin.config.js +++ b/config/plugin.config.js @@ -47,19 +47,16 @@ export default config => { matchColors: getAntdSerials('#1890ff'), // 主色系列 // 改变样式选择器,解决样式覆盖问题 changeSelector(selector) { - var fix = { - '.ant-calendar-today .ant-calendar-date': - ':not(.ant-calendar-selected-date)' + selector, - '.ant-btn:focus,.ant-btn:hover': selector - .split(',') - .map(s => s + ':not(.ant-btn-primary)') - .join(','), - '.ant-btn.active,.ant-btn:active': selector - .split(',') - .map(s => s + ':not(.ant-btn-primary)') - .join(','), - }; - return fix[selector] || selector; + switch (selector) { + case '.ant-calendar-today .ant-calendar-date': + return ':not(.ant-calendar-selected-date)' + selector; + case '.ant-btn:focus,.ant-btn:hover': + return '.ant-btn:focus:not(.ant-btn-primary),.ant-btn:hover:not(.ant-btn-primary)'; + case '.ant-btn.active,.ant-btn:active': + return '.ant-btn.active:not(.ant-btn-primary),.ant-btn:active:not(.ant-btn-primary)'; + default: + return selector; + } }, }, ]); @@ -106,10 +103,10 @@ export default config => { }; function getAntdSerials(color) { - const colorPalettes = generate(color); // 淡化(即less的tint) const lightens = new Array(9).fill().map((t, i) => { return ThemeColorReplacer.varyColor.lighten(color, i / 10); }); - return colorPalettes.concat(lightens); + const colorPalettes = generate(color); + return lightens.concat(colorPalettes); } From 600332e68355a1330fc358e3ae856047e77701d4 Mon Sep 17 00:00:00 2001 From: huangzheng Date: Sun, 2 Jun 2019 18:41:59 +0800 Subject: [PATCH 6/9] lint --- config/plugin.config.ts | 10 ++++++---- src/models/setting.ts | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/plugin.config.ts b/config/plugin.config.ts index e142565d..1bef947e 100644 --- a/config/plugin.config.ts +++ b/config/plugin.config.ts @@ -46,7 +46,7 @@ export default (config: any) => { fileName: 'css/theme-colors.css', matchColors: getAntdSerials('#1890ff'), // 主色系列 // 改变样式选择器,解决样式覆盖问题 - changeSelector(selector) { + changeSelector(selector: string) { switch (selector) { case '.ant-calendar-today .ant-calendar-date': return ':not(.ant-calendar-selected-date)' + selector; @@ -103,10 +103,12 @@ export default (config: any) => { }); }; -function getAntdSerials(color) { +const getAntdSerials = (color: string) => { + const lightNum = 9; + const devide10 = 10; // 淡化(即less的tint) - const lightens = new Array(9).fill().map((t, i) => { - return ThemeColorReplacer.varyColor.lighten(color, i / 10); + const lightens = new Array(lightNum).fill().map((t, i) => { + return ThemeColorReplacer.varyColor.lighten(color, i / devide10); }); const colorPalettes = generate(color); return lightens.concat(colorPalettes); diff --git a/src/models/setting.ts b/src/models/setting.ts index 2b8e4a1d..2ba1469e 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -12,9 +12,11 @@ export interface SettingModelType { }; } -const updateTheme = (newPrimaryColor:string) => { - const hideMessage = message.loading('正在切换主题!', 0); - themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage()); +const updateTheme = (newPrimaryColor?: string) => { + const timeOut = 0; + const hideMessage = message.loading('正在切换主题!', timeOut); + themeColorClient.changeColor(newPrimaryColor) + .finally(() => hideMessage()); }; /* From a1fba3624d98eec63d643d516d6a0cc4fcc45387 Mon Sep 17 00:00:00 2001 From: huangzheng Date: Sun, 2 Jun 2019 18:44:01 +0800 Subject: [PATCH 7/9] remove MergeLessPlugin --- config/plugin.config.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/plugin.config.ts b/config/plugin.config.ts index 1bef947e..deebcbe5 100644 --- a/config/plugin.config.ts +++ b/config/plugin.config.ts @@ -1,6 +1,6 @@ // Change theme plugin -import MergeLessPlugin from 'antd-pro-merge-less'; +// import MergeLessPlugin from 'antd-pro-merge-less'; // import AntDesignThemePlugin from 'antd-theme-webpack-plugin'; import ThemeColorReplacer from 'webpack-theme-color-replacer'; import path from 'path'; @@ -32,15 +32,15 @@ export default (config: any) => { process.env.NODE_ENV !== 'production' ) { // 将所有 less 合并为一个供 themePlugin使用 - const outFile = path.join(__dirname, '../.temp/ant-design-pro.less'); - const stylesDir = path.join(__dirname, '../src/'); + // 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('merge-less').use(MergeLessPlugin, [ + // { + // stylesDir, + // outFile, + // }, + // ]); config.plugin('webpack-theme-color-replacer').use(ThemeColorReplacer, [ { fileName: 'css/theme-colors.css', From 5c558eb8af47dbdee684fc530af7b48c6447cbe7 Mon Sep 17 00:00:00 2001 From: huangzheng Date: Sun, 2 Jun 2019 18:49:12 +0800 Subject: [PATCH 8/9] tslint --- config/plugin.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/plugin.config.ts b/config/plugin.config.ts index deebcbe5..806c344d 100644 --- a/config/plugin.config.ts +++ b/config/plugin.config.ts @@ -46,7 +46,7 @@ export default (config: any) => { fileName: 'css/theme-colors.css', matchColors: getAntdSerials('#1890ff'), // 主色系列 // 改变样式选择器,解决样式覆盖问题 - changeSelector(selector: string) { + changeSelector(selector: string): string { switch (selector) { case '.ant-calendar-today .ant-calendar-date': return ':not(.ant-calendar-selected-date)' + selector; From c744d2ae2b3d9c9bd687dca4efa4b67396939158 Mon Sep 17 00:00:00 2001 From: hz Date: Mon, 3 Jun 2019 00:41:56 +0800 Subject: [PATCH 9/9] lint --- src/models/setting.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/models/setting.ts b/src/models/setting.ts index 2ba1469e..d0d76da7 100644 --- a/src/models/setting.ts +++ b/src/models/setting.ts @@ -15,8 +15,7 @@ export interface SettingModelType { const updateTheme = (newPrimaryColor?: string) => { const timeOut = 0; const hideMessage = message.loading('正在切换主题!', timeOut); - themeColorClient.changeColor(newPrimaryColor) - .finally(() => hideMessage()); + themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage()); }; /*