add postcss plugin
This commit is contained in:
parent
a8e0de3843
commit
47ac0b329c
|
@ -14,6 +14,7 @@
|
||||||
"esbuild": "^0.23.0",
|
"esbuild": "^0.23.0",
|
||||||
"marked": "^13.0.3",
|
"marked": "^13.0.3",
|
||||||
"mime-types": "^2.1.35",
|
"mime-types": "^2.1.35",
|
||||||
|
"postcss": "^8.4.41",
|
||||||
"preact": "^10.23.1"
|
"preact": "^10.23.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
22
src/plugins/postcss.ts
Normal file
22
src/plugins/postcss.ts
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue