diff --git a/lib/css.js b/lib/css.js index ead82183548e..50e2d47574b6 100644 --- a/lib/css.js +++ b/lib/css.js @@ -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