classafDuvet::LinkTagBuilder

sys::Obj
  afDuvet::LinkTagBuilder

Defines a <link> tag to be injected into the bottom of your head. Autobuild or create via HtmlInjector.

If defining a stylesheet, note that any Content-Security-Policy response header will be updated to ensure it can be loaded.

@see https://developer.mozilla.org/en/docs/Web/HTML/Element/link

fromExternalUrl

Source

LinkTagBuilder fromExternalUrl(Uri externalUrl)

Sets the href attribute to an external URL. Returns this.

fromLocalUrl

Source

LinkTagBuilder fromLocalUrl(Uri localUrl)

Sets the href attribute to a local URL. The URL must be mapped by BedSheet's ClientAsset cache service. The URL may be rebuilt to take advantage of any asset caching strategies, such as Cold Feet. Returns this.

fromServerFile

Source

LinkTagBuilder fromServerFile(File serverFile)

Creates a href URL attribute from the given file. The file must exist on the file system and be mapped by BedSheet's FileHandler service. The URL is built to take advantage of any asset caching strategies, such as Cold Feet. Returns this.

getAttr

Source

Str? getAttr(Str name)

Returns an attribute value on the <link> element.

ifIe

Source

LinkTagBuilder ifIe(Str condition)

Wraps the <link> element in a conditional IE comment. The given condition should be everything in the square brackets. Example:

ifIe("if gt IE 6")

would render:

<!--[if gt IE 6]>
  <link src="..." >
<![endif]-->
setAttr

Source

LinkTagBuilder setAttr(Str name, Str value)

Sets an arbitrary attribute on the <link> element.

withMedia

Source

LinkTagBuilder withMedia(Str media)

Sets the media attribute. Returns this.

withRel

Source

LinkTagBuilder withRel(Str rel)

Sets the rel attribute. Returns this.

withTitle

Source

LinkTagBuilder withTitle(Str title)

Sets the title attribute. Returns this.

withType

Source

LinkTagBuilder withType(MimeType type)

Sets the type attribute. Returns this.