How to use the aphrodite/no-important.StyleSheetServer.renderStatic function in aphrodite

To help you get started, we’ve selected a few aphrodite 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 LWJGL / lwjgl3-www / server / server.js View on Github external
// We're done, render the view
    res.render('index', {
      html,
      head,
      chunks,
      chunk,
      bodyClass,
      aphrodite: css,
      ie: req.get('user-agent').indexOf('MSIE') > -1,
    });
    return;
  }

  const context = createServerRenderContext();
  ({html, css} = StyleSheetServer.renderStatic( // https://github.com/Khan/aphrodite
    () => renderToString( // https://react-router.now.sh/ServerRouter
      
        {({action, location, router}) => }
      
    )
  ));
  const result = context.getResult();

  if ( result.redirect ) {
    res.redirect(302, result.redirect.pathname);
    return;
  }
github sourcecred / sourcecred / src / homepage / server.js View on Github external
function renderRedirect(redirectTo: string) {
    const component = (
      
        
      
    );
    const {html, css} = StyleSheetServer.renderStatic(() =>
      ReactDOMServer.renderToStaticMarkup(component)
    );
    const page = dedent`\
      
      
      
      
      
      
      
      
      
      <title>${resolveTitleFromPath(routeData, path)}</title>
      <style>${require("./index.css")}</style>
      <style data-aphrodite="">${css.content}</style>
github sourcecred / sourcecred / src / homepage / server.js View on Github external
match({history, routes}, (error, redirectLocation, renderProps) =&gt; {
      if (error) {
        callback(error);
      } else if (renderProps) {
        const component = ;
        const {html, css} = StyleSheetServer.renderStatic(() =&gt;
          ReactDOMServer.renderToString(component)
        );
        const page = dedent`\
          
          
          
          
          
          
          
          
          <title>${resolveTitleFromPath(routeData, path)}</title>
          <style>${require("./index.css")}</style>
          <style data-aphrodite="">${css.content}</style>
          
github Ariel-Rodriguez / react-amp-template / src / core / index.js View on Github external
aphrodite(component) {
    debug('Running aphrodite.')
    return StyleSheetServer.renderStatic(() =>
      ReactDOMServer.renderToStaticMarkup(component)
    )
  }
github phenomic / phenomic / examples / react-app-styles-with-aphrodite / Html.js View on Github external
export default ({ App, render }: PhenomicHtmlPropsType) =&gt; {
  const {
    html: { Main, State, Script },
    css,
  } = StyleSheetServer.renderStatic(() =&gt; render());

  return (
    
      
        <style data-aphrodite="{true}">{css.content}</style>
      
      
        <main>
        
        </main>