Releases: venmo/react-html-document
Add support for favicons.
Can now use favicon
prop for favicon support. Thanks to @SpainTrain!
Firefox compatibility textContent fix
Replaces innerText with textContent on the getUniversalState
helper.
First 3.0 release
Includes changes in 3.0 beta and some bug fixes. Enjoy!
Fixes
This beta release fixes some bugs found in v3.0.0-beta, namely an issue when using getUniversalState()
on the client and smarter universal loading of the fs
module.
New Major Release Beta
This major version changes a few things:
- The
state
prop changes fromstate
touniversalState
to reduce confusion with React state and highlight that it's used for universal rendering. - It's now easier to grab the universal state from the client. Just use the following from client code (in webpack or browserify apps):
import { getUniversalState } from 'react-html-document';
getUniversalState() // will give you object you passed as `universalState` prop in the server.
- For those situations in which you'd rather inject critical css or inline scripts into the page, there's now an easier way to do it without passing in strings in the
scripts
prop array. To take advantage of it, just include an object like this in the scripts array:
const scripts = [{ file: '/path/to/my/file/in/the/server.js' }];
// pass as props to `HTMLDocument`
And the document will inline the js or css found in that path into the page. Note, that this caches the contents of the files in memory for faster access, so only use it for critical css or scripts.
Take a look at the included example-usage-server.js
file for a real-life example.
Enjoy and thanks for your support!
Updates deps for compatibility with react 15.0
v2.2.0 2.2.0
Update script tags to take any attribute.
Now you can add any attribute to script tags. For example:
<HTMLDocument scripts={[{ src: '/scripts/main.js', crossOrigin: 'anonymous' }]}/>
Safer state serialization
New in 2.0.0
This version introduces a small change to the way state
works, but it's not backwards compatible.
Before, state would be serialized into the window object using dangerouslySetInnerHTML
. This is not safe because of XSS vulnerabilities, so instead we're rendering the state on a div element on the page. For grabbing the state on the client, you'll now use that div and parse its data attribute .
const state = window.__state;
becomes
const state = JSON.parse(document.getElementById('__state').dataset.state);
Adds html attributes, fix documentation typo
v1.1.0 1.1.0
Include compiled component instead of relying on babel after install
v1.0.1 bump version