Skip to content

Commit

Permalink
fix: StyleSheet sort makes plugin doesn't work as expected (#666) (#669)
Browse files Browse the repository at this point in the history
  • Loading branch information
avxit committed Feb 22, 2022
1 parent ab224f9 commit f512a3c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/preflight.ts
Expand Up @@ -13,6 +13,7 @@ export default function preflight(
// Generate preflight style based on html tags.
const globalSheet = new StyleSheet();
const styleSheet = new StyleSheet();
const pluginSheet = new StyleSheet();

const createStyle = (
selector: string | undefined,
Expand Down Expand Up @@ -58,16 +59,16 @@ export default function preflight(
Object.values(processor._plugin.preflights).forEach((styles) => {
preflightList = preflightList.concat(styles);
});
styleSheet.add(preflightList);
pluginSheet.add(preflightList);

// always generated styles
let staticList: Style[] = [];
Object.values(processor._plugin.static).forEach((styles) => {
staticList = staticList.concat(styles);
});
styleSheet.add(staticList);
pluginSheet.add(staticList);
}

const result = styleSheet.combine().sort();
const result = styleSheet.combine().sort().extend(pluginSheet.combine().sort());
return includeGlobal ? result.extend(globalSheet.combine().sort(), false) : result;
}

0 comments on commit f512a3c

Please sign in to comment.