feat(cli): build style entry

This commit is contained in:
陈嘉涵
2019-11-21 16:03:29 +08:00
parent 4dbd444679
commit 2804d1f95e
6 changed files with 148 additions and 138 deletions

View File

@@ -88,13 +88,15 @@ export async function compileSfc(filePath: string) {
}
// compile style part
styles.forEach(async (style, index: number) => {
const prefix = index !== 0 ? `-${index + 1}` : '';
const ext = style.lang || 'css';
const cssFilePath = replaceExt(filePath, `${prefix}.${ext}`);
await Promise.all(
styles.map((style, index: number) => {
const prefix = index !== 0 ? `-${index + 1}` : '';
const ext = style.lang || 'css';
const cssFilePath = replaceExt(filePath, `-sfc${prefix}.${ext}`);
writeFileSync(cssFilePath, trim(style.content));
writeFileSync(cssFilePath, trim(style.content));
await compileStyle(cssFilePath);
});
return compileStyle(cssFilePath);
})
);
}