2023-03-02 12:24:20 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
const defaultTheme = require('tailwindcss/defaultTheme')
|
|
|
|
|
|
|
|
function rem2px(input, fontSize = 16) {
|
|
|
|
if (input == null) {
|
|
|
|
return input
|
|
|
|
}
|
|
|
|
switch (typeof input) {
|
|
|
|
case 'object':
|
|
|
|
if (Array.isArray(input)) {
|
|
|
|
return input.map((val) => rem2px(val, fontSize))
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line no-case-declarations
|
|
|
|
const ret = {}
|
|
|
|
for (const key in input) {
|
|
|
|
ret[key] = rem2px(input[key], fontSize)
|
|
|
|
}
|
|
|
|
return ret
|
|
|
|
case 'string':
|
|
|
|
return input.replace(
|
|
|
|
/(\d*\.?\d+)rem$/,
|
|
|
|
(_, val) => `${parseFloat(val) * fontSize}px`
|
|
|
|
)
|
|
|
|
case 'function':
|
|
|
|
return eval(
|
|
|
|
input
|
|
|
|
.toString()
|
|
|
|
.replace(
|
|
|
|
/(\d*\.?\d+)rem/g,
|
|
|
|
(_, val) => `${parseFloat(val) * fontSize}px`
|
|
|
|
)
|
|
|
|
)
|
|
|
|
default:
|
|
|
|
return input
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-22 17:02:34 +01:00
|
|
|
/** @type {import('tailwindcss').Config} */
|
|
|
|
module.exports = {
|
|
|
|
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
|
|
|
theme: {
|
2023-03-02 12:24:20 +01:00
|
|
|
...rem2px(defaultTheme),
|
2022-12-22 17:02:34 +01:00
|
|
|
extend: {
|
|
|
|
keyframes: {
|
|
|
|
'fade-in': {
|
|
|
|
'0%': {
|
|
|
|
opacity: '0',
|
|
|
|
},
|
|
|
|
'100%': {
|
|
|
|
opacity: '1',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
animation: {
|
|
|
|
'fade-in': 'fade-in 0.3s ease-out',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [],
|
|
|
|
}
|