chore(cli): split compilers

This commit is contained in:
陈嘉涵
2019-11-29 13:20:43 +08:00
parent e2c9628316
commit 51d2512311
9 changed files with 90 additions and 74 deletions
@@ -0,0 +1,12 @@
import postcss from 'postcss';
import postcssrc from 'postcss-load-config';
import { POSTCSS_CONFIG_FILE } from '../common/constant';
export async function compileCss(source: string | Buffer) {
const config = await postcssrc({}, POSTCSS_CONFIG_FILE);
const output = await postcss(config.plugins as any).process(source, {
from: undefined
});
return output;
}