Repository navigation
Expand file tree
/
Copy pathtailwind.config.js
More file actions
70 lines (55 loc) · 1.86 KB
/
Copy pathtailwind.config.js
File metadata and controls
70 lines (55 loc) · 1.86 KB
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
import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms';
const TYPE_SCALE_FACTOR = 4 / 3;
function scaleCssLength(value) {
if (typeof value !== 'string') {
return value;
}
const match = value.trim().match(/^(-?\d*\.?\d+)(rem|px)$/);
if (!match) {
return value;
}
const scaled = Number(match[1]) * TYPE_SCALE_FACTOR;
const rounded = Number(scaled.toFixed(4)).toString();
return `${rounded}${match[2]}`;
}
function scaleFontSizes(fontSizes) {
return Object.fromEntries(
Object.entries(fontSizes).map(([key, definition]) => {
if (typeof definition === 'string') {
return [key, scaleCssLength(definition)];
}
if (!Array.isArray(definition)) {
return [key, definition];
}
const [fontSize, options] = definition;
const scaledSize = scaleCssLength(fontSize);
if (!options || typeof options !== 'object') {
return [key, [scaledSize, options]];
}
const scaledOptions = { ...options };
if (typeof scaledOptions.lineHeight === 'string') {
scaledOptions.lineHeight = scaleCssLength(scaledOptions.lineHeight);
}
return [key, [scaledSize, scaledOptions]];
})
);
}
/** @type {import('tailwindcss').Config} */
export default {
darkMode: 'class',
content: [
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./storage/framework/views/*.php',
'./resources/views/**/*.blade.php',
],
theme: {
fontSize: scaleFontSizes(defaultTheme.fontSize),
extend: {
fontFamily: {
sans: ['Figtree', ...defaultTheme.fontFamily.sans],
},
},
},
plugins: [forms],
};