diff --git a/Gruntfile.js b/Gruntfile.js index 9f8e622e48..bcce4c838f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -136,7 +136,8 @@ module.exports = function (grunt) { almond: "../tools/vendor/almond" }, packages: [ - { name: 'react', location: '../node_modules/react', main: './react' } + { name: 'react', location: '../node_modules/react', main: './react' }, + { name: 'classnames', location: '../node_modules/classnames', main: './index' } ], include: ["almond", "react-bootstrap"], exclude: ["react"], diff --git a/docs/build.js b/docs/build.js index 4252a7c420..dbde01a273 100755 --- a/docs/build.js +++ b/docs/build.js @@ -2,12 +2,22 @@ var fs = require('fs'); var path = require('path'); -var nodejsx = require('node-jsx').install(); + +require('node-jsx').install(); + +var React = require('react'); +var routes = require('./src/Routes'); +var Router = require('react-router'); + var Root = require('./src/Root'); Root.getPages() .forEach(function (fileName) { - var RootHTML = Root.renderToString({initialPath: fileName}); - fs.writeFileSync(path.join(__dirname, fileName), RootHTML); + Router.run(routes, '/' + fileName, function (Handler) { + var RootHTML = React.renderToString(React.createElement(Handler)); + + fs.writeFileSync( + path.join(__dirname, fileName), RootHTML); + }) }); \ No newline at end of file diff --git a/docs/client.js b/docs/client.js index 80ebcd9b4e..733668d326 100644 --- a/docs/client.js +++ b/docs/client.js @@ -1,9 +1,15 @@ 'use strict'; var React = require('react'); -var Root = require('./src/Root'); +var Router = require('react-router'); +var routes = require('./src/Routes'); // For React devtools window.React = React; -React.render(React.createFactory(Root)(window.INITIAL_PROPS), document); +Router.run(routes, Router.RefreshLocation, function (Handler) { + React.render( + React.createElement(Handler, window.INITIAL_PROPS), document); +}) + + diff --git a/docs/server.js b/docs/server.js index 0b55c78101..244e93d0fb 100644 --- a/docs/server.js +++ b/docs/server.js @@ -2,15 +2,19 @@ var express = require('express'); + var development = process.env.NODE_ENV !== 'production'; var app = express(); if (development) { + var React = require('react'); var path = require('path'); var url = require('url'); var browserify = require('connect-browserify'); var nodejsx = require('node-jsx').install(); - var Root = require('./src/Root'); + + var routes = require('./src/Routes'); + var Router = require('react-router'); app = app .get('/assets/bundle.js', browserify('./client', {debug: true, watch: false})) @@ -18,9 +22,14 @@ if (development) { .use('/vendor', express.static(path.join(__dirname, 'vendor'))) .use(function renderApp(req, res) { var fileName = url.parse(req.url).pathname; - var RootHTML = Root.renderToString({initialPath: fileName}); - res.send(RootHTML); + Router.run(routes, req.url, function (Handler) { + var RootHTML = React.renderToString(React.createElement(Handler)); + + res.send(RootHTML); + }) + + }); } else { app = app diff --git a/docs/src/NavMain.js b/docs/src/NavMain.js index 72cb59f400..930064273d 100644 --- a/docs/src/NavMain.js +++ b/docs/src/NavMain.js @@ -1,19 +1,20 @@ 'use strict'; var React = require('react'); -var Router = require('react-router-component'); +var Router = require('react-router'); var Navbar = require('../../lib/Navbar'); var Nav = require('../../lib/Nav'); + var InternalLink = Router.Link; var NAV_LINKS = { 'getting-started': { - link: '/getting-started.html', + link: 'getting-started', title: 'Getting started' }, 'components': { - link: '/components.html', + link: 'components', title: 'Components' } }; @@ -24,7 +25,7 @@ var NavMain = React.createClass({ }, render: function () { - var brand = React Bootstrap; + var brand = React Bootstrap; return ( @@ -40,7 +41,7 @@ var NavMain = React.createClass({ return (
  • - {link.title} + {link.title}
  • ); } diff --git a/docs/src/ReactPlayground.js b/docs/src/ReactPlayground.js index 7ff19f1b02..28ef4fee4e 100644 --- a/docs/src/ReactPlayground.js +++ b/docs/src/ReactPlayground.js @@ -1,5 +1,5 @@ var React = require('react'); -var classSet = require('react/lib/cx'); +var classSet = require('classnames'); var CodeMirror = global.CodeMirror; var JSXTransformer = global.JSXTransformer; var Accordion = require('../../lib/Accordion'); diff --git a/docs/src/Root.js b/docs/src/Root.js index f97bc30768..be1af64df0 100644 --- a/docs/src/Root.js +++ b/docs/src/Root.js @@ -1,30 +1,7 @@ 'use strict'; var React = require('react'); -var Router = require('react-router-component'); - -var HomePage = React.createFactory(require('./HomePage')); -var GettingStartedPage = React.createFactory(require('./GettingStartedPage')); -var ComponentsPage = React.createFactory(require('./ComponentsPage')); -var NotFoundPage = React.createFactory(require('./NotFoundPage')); - -var Locations = Router.Locations; -var Location = Router.Location; -var NotFound = Router.NotFound; - -var PagesHolder = React.createClass({ - render: function () { - return ( - - - - - - - - ); - } -}); +var Router = require('react-router'); var Root = React.createClass({ statics: { @@ -110,9 +87,7 @@ var Root = React.createClass({ - - - +