From f723d6ca51476b2d7b7711f8abfc6978118d7ef9 Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Wed, 23 Mar 2016 10:43:43 +0800 Subject: [PATCH] refactor: remove some hard code --- docs/spec/layout/demo/aside.md | 1 + docs/spec/layout/demo/ceiling.md | 1 + docs/spec/layout/demo/top-aside.md | 1 + docs/spec/layout/demo/top.md | 1 + package.json | 2 +- site/component/utils.js | 3 +-- webpack.website.config.js | 6 ++++++ 7 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/spec/layout/demo/aside.md b/docs/spec/layout/demo/aside.md index 302d52e856..f9faf91b20 100644 --- a/docs/spec/layout/demo/aside.md +++ b/docs/spec/layout/demo/aside.md @@ -10,6 +10,7 @@ ````jsx import { Menu, Breadcrumb, Icon } from 'antd'; +import BrowserDemo from 'BrowserDemo'; const SubMenu = Menu.SubMenu; ReactDOM.render( diff --git a/docs/spec/layout/demo/ceiling.md b/docs/spec/layout/demo/ceiling.md index 9675c8fd7f..d9700b14e4 100644 --- a/docs/spec/layout/demo/ceiling.md +++ b/docs/spec/layout/demo/ceiling.md @@ -10,6 +10,7 @@ ````jsx import { Menu, Breadcrumb } from 'antd'; +import BrowserDemo from 'BrowserDemo'; ReactDOM.render( diff --git a/docs/spec/layout/demo/top-aside.md b/docs/spec/layout/demo/top-aside.md index b779b093c8..3c310b966b 100644 --- a/docs/spec/layout/demo/top-aside.md +++ b/docs/spec/layout/demo/top-aside.md @@ -8,6 +8,7 @@ ````jsx import { Menu, Breadcrumb, Icon } from 'antd'; +import BrowserDemo from 'BrowserDemo'; const SubMenu = Menu.SubMenu; ReactDOM.render( diff --git a/docs/spec/layout/demo/top.md b/docs/spec/layout/demo/top.md index d31adb56b6..51e6f5ffe3 100644 --- a/docs/spec/layout/demo/top.md +++ b/docs/spec/layout/demo/top.md @@ -12,6 +12,7 @@ ````jsx import { Menu, Breadcrumb } from 'antd'; +import BrowserDemo from 'BrowserDemo'; ReactDOM.render( diff --git a/package.json b/package.json index 95d72ebf84..15586ae860 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "warning": "~2.1.0" }, "devDependencies": { - "antd-md-loader": "0.1.0-beta.12", + "antd-md-loader": "0.1.0-beta.13", "atool-build": "^0.5.0", "autoprefixer": "^6.3.3", "babel-cli": "^6.2.0", diff --git a/site/component/utils.js b/site/component/utils.js index 11c76efba8..3998610fa3 100644 --- a/site/component/utils.js +++ b/site/component/utils.js @@ -2,7 +2,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { Link } from 'react-router'; import hljs from 'highlight.js'; -import antd from '../../'; function isHeading(type) { return /h[1-6]/i.test(type); @@ -22,7 +21,7 @@ export function objectToComponent(pathname, object, index) { } if (typeof object === 'function') { - return React.cloneElement(object(React, ReactDOM, antd, antd), { key: index }); + return React.cloneElement(object(React, ReactDOM), { key: index }); } if (typeof object === 'string') { diff --git a/webpack.website.config.js b/webpack.website.config.js index 5243a8e0bd..10c58e1edc 100644 --- a/webpack.website.config.js +++ b/webpack.website.config.js @@ -2,5 +2,11 @@ module.exports = function(webpackConfig) { webpackConfig.entry = { index: './site/entry/index.jsx', }; + webpackConfig.resolve.root = process.cwd(); + webpackConfig.resolve.alias = { + antd: 'index', + BrowserDemo: 'site/component/BrowserDemo', + }; + return webpackConfig; };