Commit 6efffad5 authored by afc163's avatar afc163 Committed by 陈帅

do not compile less in production

parent d1144e44
import React, { PureComponent } from 'react';
import { Select, message, Drawer, List, Switch, Divider, Icon, Button } from 'antd';
import { Select, message, Drawer, List, Switch, Divider, Icon, Button, Alert } from 'antd';
import { formatMessage } from 'umi/locale';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import { connect } from 'dva';
......@@ -215,18 +215,15 @@ class SettingDrawer extends PureComponent {
text={JSON.stringify(setting)}
onCopy={() => message.success(formatMessage({ id: 'app.setting.copyinfo' }))}
>
<Button
style={{
width: 224,
}}
>
<Icon type="copy" />
<Button block icon="copy">
{formatMessage({ id: 'app.setting.copy' })}
</Button>
</CopyToClipboard>
<div className={styles.productionHint}>
{formatMessage({ id: 'app.setting.production.hint' })}
</div>
<Alert
type="warning"
className={styles.productionHint}
message={formatMessage({ id: 'app.setting.production.hint' })}
/>
</div>
</Drawer>
);
......
......@@ -71,5 +71,5 @@
.productionHint {
font-size: 12px;
color: @text-color-secondary;
margin-top: 8px;
margin-top: 16px;
}
......@@ -202,7 +202,9 @@ class BasicLayout extends React.PureComponent {
)}
</ContainerQuery>
</DocumentTitle>
{this.state.rendering ? null : <SettingDrawer />}
{this.state.rendering && process.env.NODE_ENV === 'production' ? null : ( // Do show SettingDrawer in production
<SettingDrawer />
)}
</React.Fragment>
);
}
......
......@@ -162,6 +162,6 @@ export default {
'app.setting.othersettings': '其他设置',
'app.setting.weakmode': '色弱模式',
'app.setting.copy': '拷贝设置',
'app.setting.copyinfo': '拷贝成功,请到 src/defaultSetting.js 中替换',
'app.setting.production.hint': '设置侧边栏只会出现在开发环境,请手动配置 src/defaultSetting.js',
'app.setting.copyinfo': '拷贝成功,请到 src/defaultSetting.js 中替换默认配置',
'app.setting.production.hint': '设置栏只用于开发环境预览,请拷贝后手动修改 src/defaultSetting.js',
};
......@@ -3,6 +3,10 @@ import defaultSetting from '../defaultSetting';
let lessNodesAppended;
const updateTheme = primaryColor => {
// Don't compile less in production!
if (process.env.NODE_ENV === 'production') {
return;
}
// Determine if the component is remounted
if (!primaryColor) {
return;
......
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