forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
padding.js
27 lines (24 loc) · 959 Bytes
/
padding.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
26
27
import _ from 'lodash'
export default function() {
return function({ addUtilities, e, theme, variants }) {
const generators = [
(size, modifier) => ({
[`.${e(`p-${modifier}`)}`]: { padding: `${size}` },
}),
(size, modifier) => ({
[`.${e(`py-${modifier}`)}`]: { 'padding-top': `${size}`, 'padding-bottom': `${size}` },
[`.${e(`px-${modifier}`)}`]: { 'padding-left': `${size}`, 'padding-right': `${size}` },
}),
(size, modifier) => ({
[`.${e(`pt-${modifier}`)}`]: { 'padding-top': `${size}` },
[`.${e(`pr-${modifier}`)}`]: { 'padding-right': `${size}` },
[`.${e(`pb-${modifier}`)}`]: { 'padding-bottom': `${size}` },
[`.${e(`pl-${modifier}`)}`]: { 'padding-left': `${size}` },
}),
]
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('padding'), generator)
})
addUtilities(utilities, variants('padding'))
}
}