Skip to content

Do you think extra stuff like the following belongs here? #9

Description

@i-am-the-slime

This is really just the functions needed for following this.

Most of it depends on some other stuff that people might not want to use. However, I guess if they don't want to use it they could just not use it.

const core = require('@emotion/core')
const createEmotionServer = require('create-emotion-server').default
const createCache = require('@emotion/cache').default

exports.cacheProvider = core.CacheProvider
exports.createEmotionServer = (cache) => () => createEmotionServer(cache)
exports.createCache = createCache
exports.getExtractCritical = (server) => server.extractCritical
module Server.Emotion where

import Effect (Effect)
import React.Basic (JSX, ReactComponent)
import React.Basic.Hooks (ReactChildren)

foreign import data Server ∷ Type

foreign import data Cache ∷ Type

foreign import createEmotionServer ∷ Cache -> Effect Server

foreign import createCache ∷ Effect Cache

foreign import getExtractCritical ∷ Server -> ExtractCritical

foreign import cacheProvider ∷ ReactComponent { value ∷ Cache, children ∷ ReactChildren JSX }

type ExtractCritical
  = String -> Critical

type Critical
  = { html ∷ String, css ∷ String, ids ∷ Array String }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions