tailwindcss/src/plugins/boxShadow.js

22 lines
579 B
JavaScript
Raw Normal View History

2019-01-09 13:17:49 -05:00
import _ from 'lodash'
import prefixNegativeModifiers from '../util/prefixNegativeModifiers'
2019-01-09 13:17:49 -05:00
2019-02-28 11:51:23 -05:00
export default function() {
return function({ addUtilities, e, theme, variants }) {
2019-01-11 12:29:33 -05:00
const utilities = _.fromPairs(
_.map(theme('boxShadow'), (value, modifier) => {
const className =
modifier === 'DEFAULT' ? 'shadow' : `${e(prefixNegativeModifiers('shadow', modifier))}`
2019-01-11 12:29:33 -05:00
return [
`.${className}`,
2019-01-11 12:29:33 -05:00
{
'box-shadow': value,
},
]
})
)
2019-01-09 13:17:49 -05:00
addUtilities(utilities, variants('boxShadow'))
2019-01-09 13:17:49 -05:00
}
}