Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6743e2b

Browse files
Exposing glamor style as default allowing different ways to import the css helpers
1 parent e164074 commit 6743e2b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

lib/css.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
module.exports = require('glamor')
1+
const css = require('glamor')
2+
3+
/**
4+
* Expose style as default and the whole object as properties
5+
* so it can be used as follows:
6+
*
7+
* import css, { merge } from 'next/css'
8+
* css({ color: 'red' })
9+
* merge({ color: 'green' })
10+
* css.merge({ color: 'blue' })
11+
*/
12+
13+
css.default = css.style
14+
Object.keys(css).forEach(key => {
15+
if (key !== 'default') {
16+
css.default[key] = css[key]
17+
}
18+
})
19+
20+
module.exports = css

0 commit comments

Comments
 (0)