function renderIntro () { var introElement = React.createElement(IntroTemplate) var introMarkup = ReactDOMServer.renderToStaticMarkup(introElement) var shellElement = React.createElement(ShellTemplate, { title: 'Intro', markup: introMarkup }) var html = ReactDOMServer.renderToStaticMarkup(shellElement) html = '<!doctype html>' + html fse.outputFileSync('./build/isg/intro/index.html', html) fse.outputFileSync('./build/isg/index.html', '<!doctype html><html><head><meta http-equiv="refresh" content="0; url=intro" /></head><body></body></html>') }
function renderComponentWithRoot(RouterContext, componentProps, store) { const componentHtml = renderToString( <Provider store={store}> <RouterContext {...componentProps} /> </Provider>, ); const initialState = store.getState(); const templateMarkup = renderToStaticMarkup( <Template content={componentHtml} initialState={initialState} />, ); return `<!doctype html>\n${templateMarkup}`; }
async render(props) { const newProps = await Page.initializeProps(props); console.log(newProps); return ( "<!DOCTYPE html>" + renderToStaticMarkup(React.createElement(Page, newProps)) ); }
gulp.task('precompile', ['clean:html'], cb => { let App = require('./components/app'), React = require('react'), ReactDOM = require('react-dom/server'), htmlmin = require('gulp-htmlmin'); let stream = source(html_filename); stream.end(`<!DOCTYPE html>${ReactDOM.renderToStaticMarkup(React.createElement(App))}`); stream.pipe(streamify(gulpif(!debug, htmlmin({collapseWhitespace: true})))) .pipe(gulp.dest(html_dest)); log(`Destination HTML file written ${html_dest}${html_filename}`); cb(null); });
export function renderComponent(Element, props = {}) { return renderToStaticMarkup(<Element {...props} />); }
fs.outputFile( path.resolve("output/index.html"), rds.renderToStaticMarkup(h(Page, {title: "Hello World!"})), () => console.log("Done!") );
export default function (res, Component, data = {}) { const a = <Component {...data} /> const html = `<!DOCTYPE html>\n${renderToStaticMarkup(a)}` res.end(html) }
function renderBranding () { var brandingElement = React.createElement(BrandingTemplate, {branding: styleGuideConfig.pages.branding}) var brandingMarkup = ReactDOMServer.renderToStaticMarkup(brandingElement) var shellElement = React.createElement(ShellTemplate, { title: 'Branding', markup: brandingMarkup }) var html = ReactDOMServer.renderToStaticMarkup(shellElement) html = '<!doctype html>' + html fse.outputFileSync('./build/isg/branding/index.html', html) }
handleRequest(req, res, next, debug) { res.status(200).send(`<!doctype html>\n${renderToStaticMarkup( <Html assets={getAssets(assetsPath, debug)} />, )}`); }
createHtmlMarkupStringOfTweetList () { let tweets = this.state.collectionTweets let htmlString = ReactDOMServer.renderToStaticMarkup(<TweetList tweets={tweets} />) let htmlMarkup = { html: htmlString } return JSON.stringify(htmlMarkup) }
const renderIndexDocument = htmlWebpackPluginOptions => ` <!DOCTYPE html> ${renderToStaticMarkup(<Index {...htmlWebpackPluginOptions} />)} `
function renderApplication(props) { return doctype + renderToStaticMarkup(<HTMLDocument {...props} />); }
function renderRequirements () { var requirementsElement = React.createElement(RequirementsTemplate) var requirementsMarkup = ReactDOMServer.renderToStaticMarkup(requirementsElement) var shellElement = React.createElement(ShellTemplate, { title: 'Requirements', markup: requirementsMarkup }) var html = ReactDOMServer.renderToStaticMarkup(shellElement) html = '<!doctype html>' + html fse.outputFileSync('./build/isg/requirements/index.html', html) }
function renderScreens () { var screensElement = React.createElement(ScreensTemplate, {data: data}) var screensMarkup = ReactDOMServer.renderToStaticMarkup(screensElement) var shellElement = React.createElement(ShellTemplate, { title: 'Project Screens', markup: screensMarkup }) var html = ReactDOMServer.renderToStaticMarkup(shellElement) html = '<!doctype html>' + html fse.outputFileSync('./build/isg/screens/index.html', html) }
async render(props) { const newProps = await Page.initializeProps(props); console.log(newProps); return ( "<!DOCTYPE html>" + renderToStaticMarkup(React.createElement(Page, newProps)) ); }