Skip to main content

require_resource

Function require_resource 

Source
pub fn require_resource(resource: Resource)
Expand description

Attach a resource (CSS, JavaScript, …) to the document being built.

Port of Perl Package.pm:RequireResource L3139-3158. A resource needs either a pathname or inline content, and a mime-type: an absent type is inferred from the pathname’s extension (case-sensitively, as Perl’s $resource_types{$ext} lookup is), and a resource still lacking one after that is skipped with a warning rather than emitted untyped.

The resource is queued as pending and folded into the document later, covering Perl’s $LaTeXML::DOCUMENT ? addResource : PushValue(PENDING_RESOURCES) split — bindings routinely call this from a preamble, before any document exists.