An array of Links (a subset of links), containing only subresource links, and
for whose subresourceType
a Resource subclass exists. That is, those links that fromLink accepts.
URL of the resource.
The stylesheet’s current content, as a Blob of CSS.
Any modifications that were made to the stylesheet’s links are included.
The stylesheet’s current content, as a string of CSS.
Any modifications that were made to the stylesheet’s links are included.
Get the links defined in the stylesheet.
Links in CSS are the images and fonts that the stylesheet refers to, as well as any
@import
ed stylesheets.
The target of a Link can be modified, which updates the resource content accordingly.
Note that currently, all links we find in a stylesheet are subresource links.
Perform a function on each subresource link.
A promise that completes when all invocations have completed.
Invoked on each subresource link.
Static
fromFetch the resource a given link
points to, and return it as a Resource.
This method does not modify the given link; the caller can store the created Resource in
link.resource
, to grow a tree of links and resources.
link.resource = await Resource.fromLink(link)
The newly created Resource.
The link pointing to the resource.
Optional environment configuration.
Static
getDetermine the Resource subclass to use for the given subresource type.
The appropriate Resource subclass, or undefined
if the type is not
supported.
The type of subresource expected by the parent resource, e.g.
'image'
or 'style'
. Note this is not the same as its MIME type.
Static
fromCreate a StylesheetResource from a Blob of CSS and a URL.
Optional
config?: GlobalConfigThe stylesheet’s content, a string of CSS.
The stylesheets URL. Relevant for expanding any relative URLs it may contain.
Optional environment configuration.
StylesheetResource represents a CSS stylesheet.
It parses the stylesheet and exposes its links. Links in CSS are the images and fonts that the stylesheet refers to, as well as any
@import
ed stylesheets.To dry a stylesheet means expanding any relative URLs in links to absolute URLs.