(
builder: Builder,
options: TailwindPluginOptions = {},
)
| 7 | export type { TailwindPluginOptions } from "./types.ts"; |
| 8 | |
| 9 | export function tailwind( |
| 10 | builder: Builder, |
| 11 | options: TailwindPluginOptions = {}, |
| 12 | ): void { |
| 13 | const { exclude, ...tailwindOptions } = options; |
| 14 | const instance = postcss(twPostcss({ |
| 15 | optimize: builder.config.mode === "production", |
| 16 | ...tailwindOptions, |
| 17 | })); |
| 18 | |
| 19 | builder.onTransformStaticFile( |
| 20 | { pluginName: "tailwind", filter: /\.css$/, exclude }, |
| 21 | async (args) => { |
| 22 | const res = await instance.process(args.text, { |
| 23 | from: args.path, |
| 24 | }); |
| 25 | return { |
| 26 | content: res.content, |
| 27 | map: res.map?.toString(), |
| 28 | }; |
| 29 | }, |
| 30 | ); |
| 31 | } |
no test coverage detected