-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtailwind.config.js
125 lines (118 loc) · 4.13 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
const plugin = require('tailwindcss/plugin');
const _ = require("lodash");
const themealfa = require('./themealfa.json');
module.exports = {
mode: 'jit',
themealfa,
purge: {
content: [
'./template-parts/*.php',
'./partials/*.php',
'./resources/css/*.css',
'./resources/js/*.js',
'./comments.php',
'./archive.php',
'./header.php',
'./header-category.php',
'./footer.php',
'./single.php',
'./front-page.php',
'./index.php',
'./404.php',
'./safelist.txt'
],
},
theme: {
container: {
padding: {
DEFAULT: '1rem',
sm: '2rem',
lg: '0rem'
},
},
extend: {
colors: themealfa.colors
},
},
plugins: [
require('@tailwindcss/aspect-ratio'),
plugin(function ({addUtilities, addComponents, e, prefix, config, theme}) {
const colors = theme('colors');
const margin = theme('margin');
const screens = theme('screens');
const fontSize = theme('fontSize');
const editorColorText = _.map(config("themealfa.colors", {}), (value, key) => {
return {
[`.has-${key}-color`]: {
color: value,
},
};
});
const editorColorBackground = _.map(config("themealfa.colors", {}), (value, key) => {
return {
[`.has-${key}-background-color`]: {
backgroundColor: value,
},
};
});
const editorFontSizes = _.map(config("themealfa.fontSizes", {}), (value, key) => {
return {
[`.has-${key}-font-size`]: {
fontSize: value[0],
fontWeight: `${value[1] || 'normal'}`
},
};
});
const alignmentUtilities = {
'.alignfull': {
margin: `${margin[2] || '0.5rem'} calc(50% - 50vw)`,
maxWidth: '100vw',
"@apply w-screen": {}
},
'.alignwide': {
"@apply -mx-16 my-2 max-w-screen-xl": {}
},
'.alignnone': {
"@apply h-auto max-w-full mx-0": {}
},
".aligncenter": {
margin: `${margin[2] || '0.5rem'} auto`,
"@apply block": {}
},
[`@media (min-width: ${screens.sm || '640px'})`]: {
'.alignleft:not(.wp-block-button)': {
marginRight: margin[2] || '0.5rem',
"@apply float-left": {}
},
'.alignright:not(.wp-block-button)': {
marginLeft: margin[2] || '0.5rem',
"@apply float-right": {}
},
".wp-block-button.alignleft a": {
"@apply float-left mr-4": {},
},
".wp-block-button.alignright a": {
"@apply float-right ml-4": {},
},
},
};
const imageCaptions = {
'.wp-caption': {
"@apply inline-block": {},
'& img': {
marginBottom: margin[2] || '0.5rem',
"@apply leading-none": {}
},
},
'.wp-caption-text': {
fontSize: (fontSize.sm && fontSize.sm[0]) || '0.9rem',
color: (colors.gray && colors.gray[600]) || '#718096',
},
};
addUtilities([editorColorText, editorColorBackground, alignmentUtilities, editorFontSizes, imageCaptions], {
respectPrefix: false,
respectImportant: false,
});
}),
]
};