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(
123
123
}
124
124
return bundle as SassBundle ;
125
125
} ) ;
126
- if ( ! foundBrand . light || ! foundBrand . dark ) {
126
+ if ( maybeBrandBundle && ( ! foundBrand . light || ! foundBrand . dark ) ) {
127
127
bundles . unshift ( {
128
128
dependency,
129
129
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 && {
132
132
user : maybeBrandBundle . dark . user as SassLayer [ ] ,
133
133
default : maybeBrandBundle . dark . default ,
134
134
} || undefined ,
Original file line number Diff line number Diff line change @@ -582,14 +582,16 @@ export async function brandSassLayers(
582
582
dark : [ ]
583
583
} ;
584
584
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
+ }
593
595
}
594
596
if ( brand ?. light ?. data . color ) {
595
597
sassLayers . light . push ( brandColorLayer ( brand ?. light , nameMap ) ) ;
@@ -658,10 +660,10 @@ export async function brandSassFormatExtras(
658
660
key : "brand" ,
659
661
dependency : "bootstrap" ,
660
662
user : htmlSassBundleLayers . light ,
661
- dark : {
663
+ dark : htmlSassBundleLayers . dark . length ? {
662
664
user : htmlSassBundleLayers . dark ,
663
665
default : darkModeDefault ( format . metadata )
664
- }
666
+ } : undefined
665
667
} ,
666
668
] ,
667
669
} ,
Original file line number Diff line number Diff line change @@ -602,18 +602,18 @@ export async function projectResolveBrand(
602
602
let light , dark ;
603
603
if ( typeof brand . light === "string" ) {
604
604
light = await loadRelativeBrand ( brand . light ) ;
605
- } else {
605
+ } else if ( brand . light ) {
606
606
light = new Brand (
607
- brand . light ! ,
607
+ brand . light ,
608
608
dirname ( fileName ) ,
609
609
project . dir ,
610
610
) ;
611
611
}
612
612
if ( typeof brand . dark === "string" ) {
613
613
dark = await loadRelativeBrand ( brand . dark ) ;
614
- } else {
614
+ } else if ( brand . dark ) {
615
615
dark = new Brand (
616
- brand . dark ! ,
616
+ brand . dark ,
617
617
dirname ( fileName ) ,
618
618
project . dir ,
619
619
) ;
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