diff --git a/README.md b/README.md index 4cb0168..0fbc217 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ option | values | default `jsx.extension` | any file extension with leading `.` | `".jsx"` `doctype` | any string that can be used as [a doctype](http://en.wikipedia.org/wiki/Document_type_declaration), this will be prepended to your document | `""` `beautify` | `true`: beautify markup before outputting (note, this can affect rendering due to additional whitespace) | `false` +`static` | `true`: render markup which does not include the `data-react-checksum` or `data-reactid` fields | `true` The defaults are sane, but just in case you want to change something, here's how it would look: diff --git a/index.js b/index.js index 55e50a9..c73a0cd 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,8 @@ var DEFAULT_OPTIONS = { stripTypes: false }, doctype: '', - beautify: false + beautify: false, + static: true }; function createEngine(engineOptions) { @@ -44,8 +45,13 @@ function createEngine(engineOptions) { var component = require(filename); // Transpiled ES6 may export components as { default: Component } component = component.default || component; - markup += - React.renderToStaticMarkup(React.createElement(component, options)); + if (engineOptions.static) { + markup += + React.renderToStaticMarkup(React.createElement(component, options)); + } else { + markup += + React.renderToString(React.createElement(component, options)); + } } catch (e) { return cb(e); }