我正在尝试使用Tailwind插件,但出现了TypeScript error
。matchUtilities和主题的类型是什么?
const plugin = require('tailwindcss/plugin')
const flattenColorPalette = require('tailwindcss/lib/util/flattenColorPalette')
import type { Config } from 'tailwindcss'
type colo = ["wh","bla","ora","gra"];
const config: Config = {
plugins: [
plugin(function ({ matchUtilities, theme } : { matchUtilities : any, theme : any }) {
matchUtilities(
{
'my-custom-class': (value : colo) => ({
backgroundColor: value,
color: theme('colors.white')
}),
},
{ values: flattenColorPalette(theme('colors')) }
)
}),
],
}
export default config
字符串
3条答案
按热度按时间2lpgd9681#
我觉得你需要的是:
字符串
wqsoz72f2#
如果你的tailwind文件是js格式的,
字符串
ufj5ltwl3#
对于
matchUtilities
和theme
类型,您需要使用PluginAPI
。下面是你的例子:
字符串