forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
borderWidth.js
25 lines (22 loc) · 874 Bytes
/
borderWidth.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import _ from 'lodash'
export default function() {
return function({ addUtilities, e, theme, variants }) {
const generators = [
(value, modifier) => ({
[`.${e(`border${modifier}`)}`]: { borderWidth: `${value}` },
}),
(value, modifier) => ({
[`.${e(`border-t${modifier}`)}`]: { borderTopWidth: `${value}` },
[`.${e(`border-r${modifier}`)}`]: { borderRightWidth: `${value}` },
[`.${e(`border-b${modifier}`)}`]: { borderBottomWidth: `${value}` },
[`.${e(`border-l${modifier}`)}`]: { borderLeftWidth: `${value}` },
}),
]
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('borderWidth'), (value, modifier) => {
return generator(value, modifier === 'default' ? '' : `-${modifier}`)
})
})
addUtilities(utilities, variants('borderWidth'))
}
}