@@ -227,6 +227,12 @@ export class Renderer {
227227 } ) ;
228228 }
229229
230+ // Merge user-configured stylesheet entries first. This allows global
231+ // entries to appear before auto-collected stylesheets.
232+ this . getConfiguredStyleEntries ( ) . forEach ( ( styleEntry ) => {
233+ cssDeps . add ( styleEntry ) ;
234+ } ) ;
235+
230236 // Parse the HTML for custom elements that are found within the project
231237 // and automatically inject the script deps for them.
232238 await this . collectElementDeps ( mainHtml , jsDeps , cssDeps ) ;
@@ -580,6 +586,16 @@ export class Renderer {
580586 return orderedSitemap ;
581587 }
582588
589+
590+ private getConfiguredStyleEntries ( ) {
591+ const styleEntries = this . rootConfig . styles ?. entries || [ ] ;
592+ const basePath = this . rootConfig . base || '/' ;
593+ return styleEntries
594+ . map ( ( entry ) => entry . trim ( ) )
595+ . filter ( ( entry ) => entry )
596+ . map ( ( entry ) => normalizeStyleEntry ( entry , basePath ) ) ;
597+ }
598+
583599 private async renderHtml ( html : string , options ?: RenderHtmlOptions ) {
584600 const htmlAttrs = options ?. htmlAttrs || { } ;
585601 const headAttrs = options ?. headAttrs || { } ;
@@ -860,6 +876,11 @@ function sortLocales(a: string, b: string) {
860876 return a . localeCompare ( b ) ;
861877}
862878
879+ function normalizeStyleEntry ( entry : string , basePath : string ) {
880+ const normalizedEntry = normalizeUrlPath ( entry . replace ( / ^ \. \/ / , '' ) ) ;
881+ return normalizeUrlPath ( `${ basePath } /${ normalizedEntry } ` ) ;
882+ }
883+
863884function guessContentType ( ext : string ) : string {
864885 const normalized = ext . trim ( ) . toLowerCase ( ) . replace ( / ^ \. / , '' ) ;
865886 return CONTENT_TYPES [ normalized ] || 'application/octet-stream' ;
0 commit comments