How to use create-emotion-server - 5 common examples

To help you get started, we’ve selected a few create-emotion-server 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 emotion-js / emotion / packages / create-emotion-server / types / tests.tsx View on Github external
import createEmotionServer from 'create-emotion-server'
import { EmotionCache } from 'emotion'

declare const cache: EmotionCache

// $ExpectType EmotionServer
createEmotionServer(cache)
// $ExpectError
createEmotionServer()

const emotionServer = createEmotionServer(cache)

// $ExpectType EmotionCritical
emotionServer.extractCritical('<div></div>')
// $ExpectError
emotionServer.extractCritical()
// $ExpectError
emotionServer.extractCritical('<div></div>', undefined as any)

// $ExpectType string
emotionServer.renderStylesToString('<div></div>')
// $ExpectError
emotionServer.renderStylesToString()
github emotion-js / emotion / packages / create-emotion-server / types / tests.tsx View on Github external
import createEmotionServer from 'create-emotion-server'
import { EmotionCache } from 'emotion'

declare const cache: EmotionCache

// $ExpectType EmotionServer
createEmotionServer(cache)
// $ExpectError
createEmotionServer()

const emotionServer = createEmotionServer(cache)

// $ExpectType EmotionCritical
emotionServer.extractCritical('<div></div>')
// $ExpectError
emotionServer.extractCritical()
// $ExpectError
emotionServer.extractCritical('<div></div>', undefined as any)

// $ExpectType string
emotionServer.renderStylesToString('<div></div>')
// $ExpectError
emotionServer.renderStylesToString()
// $ExpectError
emotionServer.renderStylesToString('<div></div>', undefined as any)

// $ExpectType ReadWriteStream
github emotion-js / emotion / packages / emotion-server / src / index.js View on Github external
// @flow
import createEmotionServer from 'create-emotion-server'
import { cache } from 'emotion'

export const {
  extractCritical,
  renderStylesToString,
  renderStylesToNodeStream
} = createEmotionServer(cache)
github emotion-js / emotion / packages / core / __tests__ / server.js View on Github external
opts =&gt; {
    let cache = createCache()
    if (opts.cache) {
      cache = opts.cache()
    }
    let { renderStylesToString } = createEmotionServer(cache)
    expect(
      renderStylesToString(
        renderToString(
          {opts.render()}
        )
      )
    ).toMatchSnapshot()
  },
  cases
github emotion-js / emotion / scripts / ssr-benchmarks / bench.js View on Github external
.add('css prop compat with random', () => {
    let cache = createCache()
    createEmotionServer(cache).renderStylesToString(
      renderToString(
        React.createElement(
          CacheProvider,
          { value: cache },
          React.createElement(CssPropTriangle, {
            s: 100,
            x: 0,
            y: 0,
            random: Math.random()
          })
        )
      )
    )
  })
  .add('css func with random', () => {

create-emotion-server

SSR and style extraction tooling for emotion, The Next Generation of CSS-in-JS.

MIT
Latest version published 4 years ago

Package Health Score

78 / 100
Full package analysis

Popular create-emotion-server functions