nl_tokens: Parse paths relatives to a source .
pl_tokens: function parsePaths ( source , stylesheets , options ) { return stylesheets . map ( ( sheet ) => { let sourceProtocol ; const isLocalFile = sheet . substr ( 0 , 5 ) === 'file:' ; if ( sheet . substr ( 0 , 4 ) === 'http' ) { /* No need to parse, it's already a valid path */ return sheet ; } /* Check if we are fetching over http(s) */ if ( isURL ( source ) && ! isLocalFile ) { sourceProtocol = url . parse ( source ) . protocol ; if ( sheet . substr ( 0 , 2 ) === '//' ) { /* Use the same protocol we used for fetching this page.
                   * Default to http.
                   */ return sourceProtocol ? sourceProtocol + sheet : 'http:' + sheet ; } return url . resolve ( source , sheet ) ; } /* We are fetching local files
           * Should probably report an error if we find an absolute path and
           *   have no htmlroot specified.
           */ /* Fix the case when there is a query string or hash */ sheet = sheet . split ( '?' ) [ 0 ] . split ( '#' ) [ 0 ] ; /* Path already parsed by jsdom or user supplied local file */ if ( isLocalFile ) { sheet = url . parse ( sheet ) . path . replace ( '%20' , ' ' ) ; /* If on windows, remove first '/' */ sheet = isWindows ( ) ? sheet . substring ( 1 ) : sheet ; if ( options . htmlroot ) { return path . <mask> ( options . htmlroot , sheet ) ; } sheet = path . relative ( path . join ( path . dirname ( source ) ) , sheet ) ; } if ( sheet [ 0 ] === '/' && options . htmlroot ) { return path . join ( options . htmlroot , sheet ) ; } else if ( isHTML ( source ) ) { return path . join ( options . csspath , sheet ) ; } return path . join ( path . dirname ( source ) , options . csspath , sheet ) ; } ) ; }