@@ -185,16 +185,24 @@ export default async function fetchCss(sources) { // eslint-disable-line import/
185
185
const sourceResponses = await Promise . all ( sources . map ( source => {
186
186
if ( ! source . url ) return null ;
187
187
const { pathname} = new URL ( source . url ) ;
188
- return pathname . endsWith ( ".css" ) || pathname . endsWith ( ".js" ) ? null : doFetch ( source . url , source . fetchOpts ) ;
188
+ if ( pathname . endsWith ( ".css" ) || pathname . endsWith ( ".js" ) ) return null ;
189
+
190
+ if ( Array . isArray ( source . url ) ) {
191
+ return source . url . map ( url => doFetch ( url , source . fetchOpts ) ) ;
192
+ } else {
193
+ return doFetch ( source . url , source . fetchOpts ) ;
194
+ }
189
195
} ) ) ;
190
196
191
197
for ( const [ index , res ] of Object . entries ( sourceResponses ) ) {
192
198
const source = sources [ index ] ;
193
199
if ( res ) {
194
- validateStatus ( res , source . url , source . strict ) ;
195
- const [ styleUrls , styleTags ] = await extract ( res ) ;
196
- source . urls = styleUrls ;
197
- source . styleTags = styleTags ;
200
+ for ( const r of Array . isArray ( res ) ? res : [ res ] ) {
201
+ validateStatus ( r , source . url , source . strict ) ;
202
+ const [ styleUrls , styleTags ] = await extract ( r ) ;
203
+ source . urls . push ( ...styleUrls ) ;
204
+ source . styleTags . push ( ...styleTags ) ;
205
+ }
198
206
} else if ( source . url ) {
199
207
source . urls = [ source . url ] ;
200
208
}
0 commit comments