This repository has been archived by the owner on Jan 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
on the server side, when the docType is empty, attach the script to t…
…he end of the rendered string
- Loading branch information
Showing
5 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ language: node_js | |
node_js: | ||
- "0.12" | ||
- "0.10" | ||
- "iojs-v1.1.0" | ||
- "4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ | |
|
||
### Install | ||
```sh | ||
# react-engine needs to be installed along side react, express and optionally react-router | ||
npm install react-engine@2 express [email protected] [email protected] --save | ||
# In your express app, react-engine needs to be installed along side react and optionally react-router | ||
npm install react-engine@2 [email protected] [email protected] --save | ||
``` | ||
|
||
### Usage On Server Side | ||
|
@@ -76,7 +76,8 @@ The options object can contain properties from [react router's create configurat | |
|
||
Additionally, it can contain the following **optional** properties, | ||
|
||
- `docType`: <String> - string that can be used as a doctype (_Default: `<!DOCTYPE html>`_) | ||
- `docType`: <String> - a string that can be used as a doctype (_Default: `<!DOCTYPE html>`_). | ||
(docType might not make sense if you are rendering partials/sub page components, in that case you can pass and empty string as docType) | ||
- `routesFilePath`: <String> - path for the file that contains the react router routes. | ||
react-engine uses this behind the scenes to reload the routes file in | ||
cases where [express's app property](http://expressjs.com/api.html#app.set) `view cache` is false, this way you don't need to restart the server every time a change is made in the view files or routes file. | ||
|
@@ -125,10 +126,11 @@ var data = client.data(); | |
Pass in a JavaScript object as options to the react-engine's client boot function. | ||
The options object can contain properties from [react router's create configuration object](http://rackt.github.io/react-router/#Router.create). | ||
Additionally, it should contain the following **required** property, | ||
Additionally, it can contain the following properties, | ||
- `viewResolver` : <Function> - a function that react-engine needs to resolve the view file. | ||
- `viewResolver` : **required** - <Function> - a function that react-engine needs to resolve the view file. | ||
an example of the viewResolver can be [found here](https://github.com/paypal/react-engine/blob/ecd27b30a9028d3f02b8f8e89d355bb5fc909de9/examples/simple/public/index.js#L29). | ||
- `mountNode` : **optional** - <HTMLDOMNode> - supply a HTML DOM Node to mount the server rendered component in the case of partial/non-full page rendering. | ||
### Data for component rendering | ||
The actual data that gets fed into the component for rendering is the `renderOptions` object that [express generates](https://github.com/strongloop/express/blob/2f8ac6726fa20ab5b4a05c112c886752868ac8ce/lib/application.js#L535-L588). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters