1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/lib/css.js
2017-01-13 14:46:21 -08:00

30 lines
785 B
JavaScript

import { deprecated } from './utils'
const css = require('glamor')
// Needed because of the mutation below
delete require.cache[require.resolve('glamor')]
for (const [k, v] of Object.entries(css)) {
if (typeof v === 'function') {
css[k] = deprecated(v, 'Warning: \'next/css\' is deprecated. Please refer to the migration guide: https://github.com/zeit/next.js/wiki/Migrating-from-next-css')
}
}
/**
* 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