diff --git a/components/anchor/anchorHelper.tsx b/components/anchor/anchorHelper.tsx index ab90da0808..9f4d6f306e 100644 --- a/components/anchor/anchorHelper.tsx +++ b/components/anchor/anchorHelper.tsx @@ -87,6 +87,10 @@ class AnchorHelper { getCurrentAnchor(bounds = 5) { let activeAnchor = ''; + if (typeof document === 'undefined') { + return activeAnchor; + } + this.links.forEach(section => { const target = document.getElementById(section.substring(1)); if (target) { diff --git a/package.json b/package.json index 2a7337b84c..5cc4f6ae27 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,10 @@ "@types/react": "~0.14.41", "@types/react-dom": "~0.14.18", "antd-tools": "0.14.2", + "babel-cli": "^6.18.0", + "babel-preset-es2015": "^6.18.0", + "babel-preset-react": "^6.16.0", + "babel-preset-stage-0": "^6.16.0", "babel-eslint": "^7.1.0", "babel-jest": "^17.0.0", "babel-plugin-import": "^1.0.0", @@ -131,8 +135,15 @@ "typescript-babel-jest": "^0.1.5", "values.js": "^1.0.3" }, + "babel": { + "presets": [ + "es2015", + "react", + "stage-0" + ] + }, "scripts": { - "test": "npm run lint && npm run dist && npm run jest", + "test": "npm run lint && npm run dist && npm run jest && npm run site", "lint": "npm run tslint && npm run eslint && npm run demolint && npm run lesshint", "tslint": "antd-tools run ts-lint && npm run compile && rm -rf lib", "eslint": "eslint test site scripts ./.eslintrc.js ./webpack.config.js --ext '.js,.jsx,.tsx' --ignore-pattern '!.eslintrc.js'", @@ -147,8 +158,10 @@ "compile": "antd-tools run compile && node ./tests/dekko/lib.test.js", "start": "bisheng start -c ./site/bisheng.config.js --no-livereload", - "site": "bisheng build -c ./site/bisheng.config.js", - "deploy": "npm run clean && bisheng gh-pages -c ./site/bisheng.config.js", + "babel-site": "babel ./site/theme/template --out-dir ./site/theme/template", + "clean-site": "rm site/theme/template/**/*.js site/theme/template/*.js", + "site": "npm run babel-site && bisheng build --ssr -c ./site/bisheng.config.js && npm run clean-site", + "deploy": "npm run clean && npm run site && bisheng gh-pages --push-only", "pub": "antd-tools run update-self && antd-tools run pub", "prepublish": "antd-tools run guard", diff --git a/site/theme/en-US.js b/site/theme/en-US.js index 63ef4fe0e2..e8b6a52e03 100644 --- a/site/theme/en-US.js +++ b/site/theme/en-US.js @@ -1,4 +1,4 @@ -import appLocaleData from 'react-intl/locale-data/en'; +const appLocaleData = require('react-intl/locale-data/en'); module.exports = { locale: 'en-US', diff --git a/site/theme/static/common.less b/site/theme/static/common.less index e5016fc877..b6c5c8099a 100644 --- a/site/theme/static/common.less +++ b/site/theme/static/common.less @@ -101,8 +101,11 @@ div.main-container { animation: loadTween 2s cubic-bezier(0.785, 0.135, 0.15, 0.86) infinite; } } -#react-content:empty + .ant-site-loading { - opacity: 1; +#react-content[hidden] { + display: none; + + .ant-site-loading { + opacity: 1; + } } #loading-text { diff --git a/site/theme/static/style.js b/site/theme/static/style.js index d74e52ee9f..344678a141 100644 --- a/site/theme/static/style.js +++ b/site/theme/static/style.js @@ -1 +1,2 @@ +import 'react-github-button/assets/style.css'; import './index.less'; diff --git a/site/theme/static/template.html b/site/theme/static/template.html index b9c57fb49d..d29741fcf9 100644 --- a/site/theme/static/template.html +++ b/site/theme/static/template.html @@ -24,24 +24,28 @@
- -