Exposing glamor style as default allowing different ways to import the css helpers

This commit is contained in:
Dan Zajdband 2016-10-22 09:45:41 +02:00
parent e164074f8e
commit 6743e2b014

View file

@ -1 +1,20 @@
module.exports = require('glamor')
const css = require('glamor')
/**
* Expose style as default and the whole object as properties
* so it can be used as follows:
*
* import css, { merge } from 'next/css'
* css({ color: 'red' })
* merge({ color: 'green' })
* css.merge({ color: 'blue' })
*/
css.default = css.style
Object.keys(css).forEach(key => {
if (key !== 'default') {
css.default[key] = css[key]
}
})
module.exports = css