tailwindcss/src/plugins/space.js

23 lines
600 B
JavaScript
Raw Normal View History

2020-04-16 10:45:05 -04:00
import _ from 'lodash'
export default function() {
return function({ addUtilities, e, theme, variants }) {
const generators = [
(size, modifier) => ({
[`.${e(`space-y-${modifier}`)} > :not(template) ~ :not(template)`]: {
'margin-top': `${size}`,
},
[`.${e(`space-x-${modifier}`)} > :not(template) ~ :not(template)`]: {
'margin-left': `${size}`,
},
2020-04-16 10:45:05 -04:00
}),
]
const utilities = _.flatMap(generators, generator => {
return _.flatMap(theme('space'), generator)
2020-04-16 10:45:05 -04:00
})
addUtilities(utilities, variants('space'))
2020-04-16 10:45:05 -04:00
}
}