How to use the styletron-server-legacy.renderStatic function in styletron-server-legacy

To help you get started, we’ve selected a few styletron-server-legacy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github styletron / styletron / packages / demos / react-demo-legacy / src / server.js View on Github external
server.use((req, res) => {
  const app = createElement(App, {
    path: req.url
  });
  const {html, css, injectedKeys} = StyletronServerLegacy.renderStatic(() => {
    return renderToString(app);
  });

  const hydrationSrc = generateHydrationScriptSrc(injectedKeys);

  res.end(getMarkup(html, css, hydrationSrc));
});
github styletron / styletron / packages / demos / react-demo-compat / src / server.js View on Github external
server.use((req, res) => {
  const styletron = new StyletronServer();
  const app = createElement(StyletronProvider, {styletron}, createElement(App, {
    path: req.url
  }));
  const {html, css, injectedKeys} = StyletronServerLegacy.renderStatic(() => {
    return renderToString(app);
  });
  
  const modernCss = styletron.getStylesheetsHtml();
  const hydrationSrc = generateHydrationScriptSrc(injectedKeys);

  res.end(getMarkup(html, modernCss, css, hydrationSrc));
});

styletron-server-legacy

Legacy package for 1.x styletron-server

MIT
Latest version published 7 years ago

Package Health Score

53 / 100
Full package analysis

Popular styletron-server-legacy functions

Similar packages