threepointone/glamor

Allow definition of global styles with objects and helpers

Closed this issue · 4 comments

Currently we can do

insertRule('html, body { padding: 0 }')

It would be great to support same definition as in createElement helper. Something like:

global('html, body', { padding: 0 })
global('a', [ { color: 'red'}, hover({ color: 'blue' }) ])

Good idea, I like it! Have to call it something other than global, but I'm for it. I'll have to get to this after a week or so, unless I see a PR :)

How about this

insertGlobal('html, body', { padding: 0 })
insertGlobal('a', { color: 'red' })
insertGlobal('a:hover', { color: 'blue' })

import { insertGlobal } from 'glamor' is available in 2.17.2, give it a spin and let me know how it feels.

closing this for now. v3 will merge insertRule and insertGlobal (I think)