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
LinkTagBuilder fromExternalUrl(Uri externalUrl)
Sets the
href
attribute to an external URL. Returnsthis
.- fromLocalUrl
LinkTagBuilder fromLocalUrl(Uri localUrl)
Sets the
href
attribute to a local URL. The URL must be mapped by BedSheet'sClientAsset
cache service. The URL may be rebuilt to take advantage of any asset caching strategies, such as Cold Feet. Returnsthis
.- fromServerFile
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'sFileHandler
service. The URL is built to take advantage of any asset caching strategies, such as Cold Feet. Returnsthis
.- getAttr
Returns an attribute value on the
<link>
element.- ifIe
LinkTagBuilder ifIe(Str condition)
Wraps the
<link>
element in a conditional IE comment. The givencondition
should be everything in the square brackets. Example:ifIe("if gt IE 6")
would render:
<!--[if gt IE 6]> <link src="..." > <![endif]-->
- setAttr
LinkTagBuilder setAttr(Str name, Str value)
Sets an arbitrary attribute on the
<link>
element.- withMedia
LinkTagBuilder withMedia(Str media)
Sets the
media
attribute. Returnsthis
.- withRel
LinkTagBuilder withRel(Str rel)
Sets the
rel
attribute. Returnsthis
.- withTitle
LinkTagBuilder withTitle(Str title)
Sets the
title
attribute. Returnsthis
.- withType
LinkTagBuilder withType(MimeType type)
Sets the
type
attribute. Returnsthis
.