Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
i-am-the-slime opened this issue Aug 1, 2020 · 1 comment
Open

Comments

@i-am-the-slime
Copy link
Member

i-am-the-slime commented Aug 1, 2020

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 }
@megamaddu
Copy link
Member

I think this is probably fine as long as it's a separate module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants