major: import Fresh 2.0 code (#2449)

🎉
This commit is contained in:
Marvin Hagemeister
2024-05-24 09:40:08 +02:00
committed by GitHub
parent 990357629e
commit 287929e4d2
958 changed files with 15794 additions and 28287 deletions
+26
View File
@@ -0,0 +1,26 @@
import type { TailwindPluginOptions } from "./types.ts";
import { initTailwind } from "./compiler.ts";
import type { Builder } from "@fresh/core/dev";
import type { App } from "@fresh/core";
export function tailwind<T>(
builder: Builder,
app: App<T>,
options: TailwindPluginOptions = {},
): void {
const processor = initTailwind(app.config, options);
builder.onTransformStaticFile(
{ pluginName: "tailwind", filter: /\.css$/ },
async (args) => {
const instance = await processor;
const res = await instance.process(args.text, {
from: args.path,
});
return {
content: res.content,
map: res.map?.toString(),
};
},
);
}