forked from phylor/covid-volunteers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tailwind.config.js
52 lines (45 loc) · 1.31 KB
/
tailwind.config.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const plugin = require('tailwindcss/plugin')
module.exports = {
theme: {
extend: {},
},
variants: {},
plugins: [
require('@tailwindcss/ui'),
/*
* Spacing utilities
* Ex: .space-y-bottom-2 space-x-right-4
*/
plugin(function({ addUtilities, theme }) {
const property = 'margin'
const axes = ['x', 'y']
const directions = {
x: ['right', 'left'],
y: ['top', 'bottom'],
}
let utilities = {}
axes.forEach((axis) => {
directions[axis].forEach((direction) => {
const spacing = []
Object.keys(theme('spacing')).filter((key) => {
// fetching only the absolute values (numbers, no 1/2, 3/5, etc.)
if (!key.includes('/')) {
spacing[key] = theme('spacing')[key];
}
})
Object.keys(spacing).forEach((key) => {
const value = spacing[key]
const className = `.space-${axis}-${direction}-${key}`
const childrenProperties = {}
childrenProperties[`${property}-${direction}`] = value
const properties = {
'>*' : childrenProperties,
}
utilities[className] = properties
})
})
})
addUtilities(utilities, {variants: ['responsive']})
}),
],
}