@@ -11,18 +11,29 @@ import {
1111 FormatExtras ,
1212 kSassBundles ,
1313 SassBundle ,
14+ SassBundleLayers ,
1415} from "../../config/types.ts" ;
1516import { ProjectContext } from "../../project/types.ts" ;
1617
17- export async function brandSassFormatExtras (
18- _format : Format ,
18+ export async function brandBootstrapSassBundles (
1919 project : ProjectContext ,
20- ) : Promise < FormatExtras > {
20+ key : string ,
21+ ) : Promise < SassBundle [ ] > {
22+ return ( await brandBootstrapSassBundleLayers ( project , key ) ) . map (
23+ ( layer : SassBundleLayers ) => {
24+ return {
25+ ...layer ,
26+ dependency : "bootstrap" ,
27+ } ;
28+ } ,
29+ ) ;
30+ }
31+ export async function brandBootstrapSassBundleLayers (
32+ project : ProjectContext ,
33+ key : string ,
34+ ) : Promise < SassBundleLayers [ ] > {
2135 const brand = await project . resolveBrand ( ) ;
22- if ( ! brand ) {
23- return { } ;
24- }
25- const sassBundles : SassBundle [ ] = [ ] ;
36+ const sassBundles : SassBundleLayers [ ] = [ ] ;
2637
2738 if ( brand ?. data . color ) {
2839 const colorVariables : string [ ] = [ "/* color variables from _brand.yml */" ] ;
@@ -40,9 +51,9 @@ export async function brandSassFormatExtras(
4051 ) ;
4152 }
4253 // const colorEntries = Object.keys(brand.color);
43- const colorBundle : SassBundle = {
44- key : "brand-color" ,
45- dependency : "bootstrap" ,
54+ const colorBundle : SassBundleLayers = {
55+ key,
56+ // dependency: "bootstrap",
4657 quarto : {
4758 defaults : colorVariables . join ( "\n" ) ,
4859 uses : "" ,
@@ -54,9 +65,37 @@ export async function brandSassFormatExtras(
5465 sassBundles . push ( colorBundle ) ;
5566 }
5667
57- return {
58- html : {
59- [ kSassBundles ] : sassBundles ,
60- } ,
61- } ;
68+ return sassBundles ;
69+ }
70+
71+ export async function brandRevealSassBundleLayers (
72+ _format : Format ,
73+ project : ProjectContext ,
74+ ) : Promise < SassBundleLayers [ ] > {
75+ return brandBootstrapSassBundleLayers ( project , "reveal-theme" ) ;
76+ }
77+
78+ export async function brandSassFormatExtras (
79+ _format : Format ,
80+ project : ProjectContext ,
81+ ) : Promise < FormatExtras > {
82+ const htmlSassBundleLayers = await brandBootstrapSassBundleLayers (
83+ project ,
84+ "brand" ,
85+ ) ;
86+ const htmlSassBundles : SassBundle [ ] = htmlSassBundleLayers . map ( ( layer ) => {
87+ return {
88+ ...layer ,
89+ dependency : "bootstrap" ,
90+ } ;
91+ } ) ;
92+ if ( htmlSassBundles . length === 0 ) {
93+ return { } ;
94+ } else {
95+ return {
96+ html : {
97+ [ kSassBundles ] : htmlSassBundles ,
98+ } ,
99+ } ;
100+ }
62101}
0 commit comments