Skip to content

Commit

Permalink
Merge pull request react-bootstrap#823 from react-bootstrap/fix-prod-…
Browse files Browse the repository at this point in the history
…docs-error

Fix the docs prod error on the home page alone.
  • Loading branch information
AlexKVal committed Jun 13, 2015
2 parents 6bcddb7 + 2bebdb4 commit fd31cbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const readmeDest = path.join(docsBuilt, 'README.md');
*/
function generateHTML(fileName) {
return new Promise((resolve, reject) => {
Router.run(routes, '/' + fileName, Handler => {
const urlSlug = fileName === 'index.html' ? '/' : `/${fileName}`;

Router.run(routes, urlSlug, Handler => {
let html = React.renderToString(React.createElement(Handler));
html = '<!doctype html>' + html;
let write = fsp.writeFile(path.join(docsBuilt, fileName), html);
Expand Down
3 changes: 1 addition & 2 deletions docs/src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import NotFoundPage from './NotFoundPage';
import {Route, DefaultRoute, NotFoundRoute} from 'react-router';

export default (
<Route name='app' path='/' handler={Root}>
<Route name='home' path='/' handler={Root}>
<DefaultRoute handler={HomePage}/>
<NotFoundRoute handler={NotFoundPage} />

<Route name='home' path='index.html' handler={HomePage} />
<Route name='introduction' path='introduction.html' handler={IntroductionPage} />
<Route name='getting-started' path='getting-started.html' handler={GettingStartedPage} />
<Route name='components' path='components.html' handler={ComponentsPage} />
Expand Down

0 comments on commit fd31cbc

Please sign in to comment.