Class RootTemplate<T>

A template that can be used to render the root HTML content. Automatically adds a doctype and root tag to the rendered content.

Type Parameters

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

  • Creates a new root template.

    Type Parameters

    Parameters

    • content: TemplateContent | ((params) => TemplateContent | Promise<TemplateContent>)

      The content of the template, or a function that returns the content.

    • doctype: null | string = '<!DOCTYPE html>'

      The doctype tag to use for the template. Defaults to <!DOCTYPE html>. Set to null to disable.

    • rootTag: NonVoidTagName | ((params, content) => Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow"> | Promise<Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow">>) = 'html'

      The root tag to use for the template. Defaults to html.

    Returns RootTemplate<T>

Properties

content: TemplateContent | ((params) => TemplateContent | Promise<TemplateContent>)

The content of the template, or a function that returns the content.

Type declaration

    • (params): TemplateContent | Promise<TemplateContent>
    • Parameters

      • params: T

      Returns TemplateContent | Promise<TemplateContent>

doctype: null | string = '<!DOCTYPE html>'

The doctype tag to use for the template. Defaults to <!DOCTYPE html>. Set to null to disable.

rootTag: NonVoidTagName | ((params, content) => Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow"> | Promise<Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow">>) = 'html'

The root tag to use for the template. Defaults to html.

Type declaration

    • (params, content): Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow"> | Promise<Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow">>
    • Parameters

      Returns Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow"> | Promise<Tag<NonVoidSelectorString, "object" | "search" | "big" | "blink" | "small" | "strike" | "sub" | "sup" | "map" | "time" | "code" | "data" | "progress" | "button" | "address" | "center" | "content" | "font" | "a" | "abbr" | "article" | "aside" | "audio" | "b" | "bdi" | "bdo" | "blockquote" | "body" | "canvas" | "caption" | "cite" | "colgroup" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "html" | "i" | "iframe" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "mark" | "menu" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "title" | "tr" | "u" | "ul" | "var" | "video" | "acronym" | "applet" | "basefont" | "bgsound" | "dir" | "frame" | "frameset" | "isindex" | "listing" | "marquee" | "menuitem" | "multicol" | "nextid" | "nobr" | "noembed" | "noframes" | "plaintext" | "rb" | "rtc" | "spacer" | "tt" | "xmp" | "image" | "math" | "element" | "rbc" | "shadow">>

Methods

  • Renders the template with the given params (if content is a function).

    Parameters

    • params: T

      The params to pass to the template.

    Returns Promise<RawContent>

    The rendered template as a RawContent instance.

  • Renders the template with the given params (if content is a function).

    Parameters

    • params: T

      The params to pass to the template.

    Returns Promise<string>

    The rendered template.

Generated using TypeDoc