File tree Expand file tree Collapse file tree 6 files changed +68
-17
lines changed
tests/docs/smoke-all/dark-mode Expand file tree Collapse file tree 6 files changed +68
-17
lines changed Original file line number Diff line number Diff line change @@ -123,12 +123,12 @@ export async function resolveSassBundles(
123123 }
124124 return bundle as SassBundle ;
125125 } ) ;
126- if ( ! foundBrand . light || ! foundBrand . dark ) {
126+ if ( maybeBrandBundle && ( ! foundBrand . light || ! foundBrand . dark ) ) {
127127 bundles . unshift ( {
128128 dependency,
129129 key : "brand" ,
130- user : ! foundBrand . light && maybeBrandBundle ? .user as SassLayer [ ] || [ ] ,
131- dark : ! foundBrand . dark && maybeBrandBundle ? .dark ?. user && {
130+ user : ! foundBrand . light && maybeBrandBundle . user as SassLayer [ ] || [ ] ,
131+ dark : ! foundBrand . dark && maybeBrandBundle . dark ?. user && {
132132 user : maybeBrandBundle . dark . user as SassLayer [ ] ,
133133 default : maybeBrandBundle . dark . default ,
134134 } || undefined ,
Original file line number Diff line number Diff line change @@ -582,14 +582,16 @@ export async function brandSassLayers(
582582 dark : [ ]
583583 } ;
584584
585- for ( const layer of [ sassLayers . light , sassLayers . dark ] ) {
586- layer . push ( {
587- defaults : '$theme: "brand" !default;' ,
588- uses : "" ,
589- functions : "" ,
590- mixins : "" ,
591- rules : "" ,
592- } ) ;
585+ for ( const mode of [ "light" , "dark" ] as Array < "dark" | "light" > ) {
586+ if ( brand && brand [ mode ] ) {
587+ sassLayers [ mode ] . push ( {
588+ defaults : '$theme: "brand" !default;' ,
589+ uses : "" ,
590+ functions : "" ,
591+ mixins : "" ,
592+ rules : "" ,
593+ } ) ;
594+ }
593595 }
594596 if ( brand ?. light ?. data . color ) {
595597 sassLayers . light . push ( brandColorLayer ( brand ?. light , nameMap ) ) ;
@@ -658,10 +660,10 @@ export async function brandSassFormatExtras(
658660 key : "brand" ,
659661 dependency : "bootstrap" ,
660662 user : htmlSassBundleLayers . light ,
661- dark : {
663+ dark : htmlSassBundleLayers . dark . length ? {
662664 user : htmlSassBundleLayers . dark ,
663665 default : darkModeDefault ( format . metadata )
664- }
666+ } : undefined
665667 } ,
666668 ] ,
667669 } ,
Original file line number Diff line number Diff line change @@ -602,18 +602,18 @@ export async function projectResolveBrand(
602602 let light , dark ;
603603 if ( typeof brand . light === "string" ) {
604604 light = await loadRelativeBrand ( brand . light ) ;
605- } else {
605+ } else if ( brand . light ) {
606606 light = new Brand (
607- brand . light ! ,
607+ brand . light ,
608608 dirname ( fileName ) ,
609609 project . dir ,
610610 ) ;
611611 }
612612 if ( typeof brand . dark === "string" ) {
613613 dark = await loadRelativeBrand ( brand . dark ) ;
614- } else {
614+ } else if ( brand . dark ) {
615615 dark = new Brand (
616- brand . dark ! ,
616+ brand . dark ,
617617 dirname ( fileName ) ,
618618 project . dir ,
619619 ) ;
Original file line number Diff line number Diff line change 1+ ---
2+ format : html
3+ brand :
4+ light : united-brand.yml
5+ _quarto :
6+ tests :
7+ html :
8+ ensureHtmlElements :
9+ - []
10+ - ["link[href*=\"-dark-\"]"]
11+ ---
12+
13+ ## Hello
14+
15+ ``` markdown
16+ 
17+ ```
Original file line number Diff line number Diff line change 1+ ---
2+ format : html
3+ theme :
4+ light : united
5+ _quarto :
6+ tests :
7+ html :
8+ ensureHtmlElements :
9+ - []
10+ - ["link[href*=\"-dark-\"]"]
11+ ---
12+
13+ ## Hello
14+
15+ ``` markdown
16+ 
17+ ```
Original file line number Diff line number Diff line change 1+ ---
2+ format : html
3+ _quarto :
4+ tests :
5+ html :
6+ ensureHtmlElements :
7+ - []
8+ - ["link[href*=\"-dark-\"]"]
9+ ---
10+
11+ ## Hello
12+
13+ ``` markdown
14+ 
15+ ```
You can’t perform that action at this time.
0 commit comments