Support grouped tw
This commit is contained in:
15
src/index.ts
15
src/index.ts
@ -17,7 +17,10 @@ type GetClassName = (className: string) => string;
|
||||
* Tagged template macro function for Tailwind classes
|
||||
* @example "tw" => tw`p-2 text-center`
|
||||
*/
|
||||
export type TaggedTailwindFunction = (strings: TemplateStringsArray) => string;
|
||||
export interface TailwindFunction {
|
||||
(strings: TemplateStringsArray): string;
|
||||
(group: { [modifier: string]: string }): string;
|
||||
}
|
||||
|
||||
export interface TailwindPluginOptions {
|
||||
/**
|
||||
@ -53,13 +56,13 @@ export interface TailwindPluginOptions {
|
||||
jsxAttributeAction?: "delete" | "preserve" | ["rename", string];
|
||||
|
||||
/**
|
||||
* Tagged template macro function to use for Tailwind classes
|
||||
* Template macro function to use for Tailwind classes
|
||||
* @default "tw"
|
||||
* @example
|
||||
* declare const tw: TaggedTailwindFunction;
|
||||
* declare const tw: TailwindFunction;
|
||||
* "tw" => tw`p-2 text-center`
|
||||
*/
|
||||
taggedTemplateName?: string | undefined;
|
||||
macroFunction?: string | undefined;
|
||||
|
||||
/**
|
||||
* The prefix to use for the generated class names.
|
||||
@ -98,7 +101,7 @@ export type ResolveTailwindOptions = SetRequired<
|
||||
| "postCSSPlugins"
|
||||
| "styleMap"
|
||||
| "tailwindConfig"
|
||||
| "taggedTemplateName"
|
||||
| "macroFunction"
|
||||
>;
|
||||
|
||||
/**
|
||||
@ -130,7 +133,7 @@ export function getTailwindPlugins(options: TailwindPluginOptions) {
|
||||
jsxAttributeName: "css",
|
||||
postCSSPlugins: [],
|
||||
styleMap: new Map(),
|
||||
taggedTemplateName: undefined,
|
||||
macroFunction: undefined,
|
||||
tailwindConfig: {},
|
||||
...options,
|
||||
};
|
||||
|
Reference in New Issue
Block a user