Skip to content
Prev Previous commit
try to use postcss async wherever possible
  • Loading branch information
itsMapleLeaf committed Sep 21, 2020
commit a28261267a63eca661b22786a28394b81779b7fd
4 changes: 3 additions & 1 deletion src/parse-engines/types/html-parse-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class HtmlParseEngine implements IParseEngine {
},
ontext: (text: string) => {
if (tag === "style") {
// this should probably be async... not sure how to do that?
definitions.push(...CssClassExtractor.extract(postcss().process(text).root));
}
},
Expand All @@ -51,7 +52,8 @@ class HtmlParseEngine implements IParseEngine {

await Bluebird.map(urls, async (url) => {
const content = await request.get(url);
definitions.push(...CssClassExtractor.extract(postcss().process(content).root));
const postcssResult = await postcss().process(content);
definitions.push(...CssClassExtractor.extract(postcssResult.root));
}, { concurrency: 10 });

return definitions;
Expand Down