mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
site: improve performance
This commit is contained in:
parent
b0f28a218e
commit
7c7a365960
@ -78,7 +78,7 @@
|
||||
"babel-eslint": "^6.0.2",
|
||||
"babel-jest": "^13.2.2",
|
||||
"babel-plugin-antd": "^0.4.0",
|
||||
"bisheng": "^0.11.0",
|
||||
"bisheng": "^0.12.0",
|
||||
"bisheng-plugin-antd": "~0.2.0",
|
||||
"bisheng-plugin-description": "^0.1.1",
|
||||
"bisheng-plugin-react": "^0.2.0",
|
||||
|
@ -13,6 +13,18 @@ module.exports = {
|
||||
}
|
||||
return nodePath.endsWith('/demo');
|
||||
},
|
||||
pick: {
|
||||
components(markdownData) {
|
||||
const filename = markdownData.meta.filename;
|
||||
if (!/^components/.test(filename) ||
|
||||
/\/demo$/.test(path.dirname(filename)) ||
|
||||
/\.en-US\.md/.test(filename)) return;
|
||||
|
||||
return {
|
||||
meta: markdownData.meta,
|
||||
};
|
||||
},
|
||||
},
|
||||
theme: './site/theme',
|
||||
htmlTemplate: './site/theme/static/template.html',
|
||||
plugins: [
|
||||
|
@ -89,7 +89,8 @@ export default class Header extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { location, components } = this.props;
|
||||
const { location, picked } = this.props;
|
||||
const components = picked.components;
|
||||
const module = location.pathname.replace(/\/$/, '')
|
||||
.split('/').slice(0, -1)
|
||||
.join('/');
|
||||
|
@ -1,10 +1,8 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { addLocaleData, IntlProvider } from 'react-intl';
|
||||
import Promise from 'bluebird';
|
||||
import Header from './Header';
|
||||
import Footer from './Footer';
|
||||
import * as utils from '../utils';
|
||||
import enLocale from '../../en-US.js';
|
||||
import cnLocale from '../../zh-CN.js';
|
||||
import '../../static/style';
|
||||
@ -42,12 +40,6 @@ const isZhCN = (typeof localStorage !== 'undefined' && localStorage.getItem('loc
|
||||
const appLocale = isZhCN ? cnLocale : enLocale;
|
||||
addLocaleData(appLocale.data);
|
||||
|
||||
export function collect(nextProps, callback) {
|
||||
const componentsList = utils.collectDocs(nextProps.data.components);
|
||||
Promise.all(componentsList)
|
||||
.then((list) => callback(null, { ...nextProps, components: list }));
|
||||
}
|
||||
|
||||
export default class Layout extends React.Component {
|
||||
static contextTypes = {
|
||||
router: React.PropTypes.object.isRequired,
|
||||
|
Loading…
Reference in New Issue
Block a user