forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmargin.js
More file actions
27 lines (24 loc) · 946 Bytes
/
margin.js
File metadata and controls
27 lines (24 loc) · 946 Bytes
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, config, e }) {
const generators = [
(size, modifier) => ({
[`.${e(`m-${modifier}`)}`]: { margin: `${size}` },
}),
(size, modifier) => ({
[`.${e(`my-${modifier}`)}`]: { 'margin-top': `${size}`, 'margin-bottom': `${size}` },
[`.${e(`mx-${modifier}`)}`]: { 'margin-left': `${size}`, 'margin-right': `${size}` },
}),
(size, modifier) => ({
[`.${e(`mt-${modifier}`)}`]: { 'margin-top': `${size}` },
[`.${e(`mr-${modifier}`)}`]: { 'margin-right': `${size}` },
[`.${e(`mb-${modifier}`)}`]: { 'margin-bottom': `${size}` },
[`.${e(`ml-${modifier}`)}`]: { 'margin-left': `${size}` },
}),
]
const utilities = _.flatMap(generators, generator => {
return _.flatMap(config('margin'), generator)
})
addUtilities(utilities, config('modules.margin'))
}
}