Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/command/render/pandoc-html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,31 @@ export async function resolveSassBundles(
//
// the brand bundle itself doesn't have any 'brand' entries;
// those are used to specify where the brand-specific layers should be inserted
// in the final bundle. We filter
// in the final bundle.
const brandLayersMaybeBrand = bundlesWithBrand.find((bundle) =>
bundle.key === "brand"
)?.user || [];
assert(!brandLayersMaybeBrand.find((v) => v === "brand"));
const brandLayers = brandLayersMaybeBrand as SassLayer[];
let foundBrand = false;
const bundles: SassBundle[] = bundlesWithBrand.filter((bundle) =>
bundle.key !== "brand"
).map((bundle) => {
const userBrand = bundle.user?.findIndex((layer) => layer === "brand");
if (userBrand && userBrand !== -1) {
bundle = cloneDeep(bundle);
bundle.user!.splice(userBrand, 1, ...brandLayers);
foundBrand = true;
}
return bundle as SassBundle;
});
if (!foundBrand) {
bundles.unshift({
dependency,
key: "brand",
user: brandLayers,
});
}

// See if any bundles are providing dark specific css
const hasDark = bundles.some((bundle) => bundle.dark !== undefined);
Expand Down
Loading