diff --git a/bun.lockb b/bun.lockb index 5a20e55..3e59b1f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 9833157..491bb0c 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "esbuild": "^0.23.0", "marked": "^13.0.3", "mime-types": "^2.1.35", + "postcss": "^8.4.41", "preact": "^10.23.1" } } \ No newline at end of file diff --git a/src/plugins/postcss.ts b/src/plugins/postcss.ts new file mode 100644 index 0000000..aed5c36 --- /dev/null +++ b/src/plugins/postcss.ts @@ -0,0 +1,22 @@ +import { Plugin } from ".."; +import postcss from "postcss"; + +export default class PostCSS extends Plugin { + build: undefined; + + name = "postcss"; + rewriteTriggers = ["css"]; + renameTo = "css"; + longLasting = false; + plugins: postcss.AcceptedPlugin[] = []; + + constructor(plugins: postcss.AcceptedPlugin[]) { + super(); + this.plugins = plugins; + } + + async rewriteFile(file: string) { + const data = await postcss(this.plugins).process(file, {from: undefined}); + return data.css; + } +}