@@ -240,27 +240,26 @@ const brandColorBundle = (
240240 return colorBundle ;
241241} ;
242242
243- const brandBootstrapBundle = (
244- brand : Brand ,
245- key : string ,
246- ) : SassBundleLayers => {
243+ type BootstrapDefaultsConfig = {
244+ uses ?: string ;
245+ functions ?: string ;
246+ defaults ?: Record < string , Record < string , string | boolean | number | null > > ;
247+ mixins ?: string ;
248+ rules ?: string ;
249+ } ;
250+
251+ const brandBootstrapBundle = ( brand : Brand , key : string ) : SassBundleLayers => {
247252 // Bootstrap Variables from brand.defaults.bootstrap
248- const brandBootstrap = brand ?. data ?. defaults ?. bootstrap as unknown as Record <
249- string ,
250- Record < string , string | boolean | number | null >
251- > ;
253+ const brandBootstrap = brand ?. data ?. defaults
254+ ?. bootstrap as unknown as BootstrapDefaultsConfig ;
252255
253256 const bsVariables : string [ ] = [
254257 "/* Bootstrap variables from _brand.yml */" ,
255- '// quarto-scss-analysis-annotation { "action": "push", "origin": "_brand.yml defaults.bootstrap" }' ,
258+ '// quarto-scss-analysis-annotation { "action": "push", "origin": "_brand.yml defaults.bootstrap.defaults " }' ,
256259 ] ;
257- for ( const bsVar of Object . keys ( brandBootstrap ) ) {
258- if ( bsVar === "version" ) {
259- continue ;
260- }
261- bsVariables . push (
262- `$${ bsVar } : ${ brandBootstrap [ bsVar ] } !default;` ,
263- ) ;
260+ const bsDefaults = brandBootstrap . defaults || { } ;
261+ for ( const bsVar of Object . keys ( bsDefaults ) ) {
262+ bsVariables . push ( `$${ bsVar } : ${ bsDefaults [ bsVar ] } !default;` ) ;
264263 }
265264 bsVariables . push ( '// quarto-scss-analysis-annotation { "action": "pop" }' ) ;
266265
@@ -292,23 +291,39 @@ const brandBootstrapBundle = (
292291 continue ;
293292 }
294293
295- bsColors . push (
296- `$${ colorKey } : ${ brand . getColor ( colorKey ) } !default;` ,
297- ) ;
294+ bsColors . push ( `$${ colorKey } : ${ brand . getColor ( colorKey ) } !default;` ) ;
298295 }
299296 }
300297
301298 bsColors . push ( '// quarto-scss-analysis-annotation { "action": "pop" }' ) ;
302299
300+ const scssWithQuartoAnnotation = (
301+ x : string | undefined ,
302+ origin : string
303+ ) : string => {
304+ if ( ! x ) {
305+ return "" ;
306+ }
307+
308+ return [
309+ `// quarto-scss-analysis-annotation { "action": "push", "origin": "_brand.yml defaults.bootstrap.${ origin } " }` ,
310+ x ,
311+ '// quarto-scss-analysis-annotation { "action": "pop" }' ,
312+ ] . join ( "\n" ) ;
313+ } ;
314+
303315 const bsBundle : SassBundleLayers = {
304316 key,
305317 // dependency: "bootstrap",
306318 quarto : {
307319 defaults : bsColors . join ( "\n" ) + "\n" + bsVariables . join ( "\n" ) ,
308- uses : "" ,
309- functions : "" ,
310- mixins : "" ,
311- rules : "" ,
320+ uses : scssWithQuartoAnnotation ( brandBootstrap . uses , "uses" ) ,
321+ functions : scssWithQuartoAnnotation (
322+ brandBootstrap . functions ,
323+ "functions"
324+ ) ,
325+ mixins : scssWithQuartoAnnotation ( brandBootstrap . mixins , "mixins" ) ,
326+ rules : scssWithQuartoAnnotation ( brandBootstrap . rules , "rules" ) ,
312327 } ,
313328 } ;
314329 return bsBundle ;
0 commit comments