tagFunction: Tag function

Description Usage Arguments Examples

View source: R/tags.R

Description

Create 'lazily' rendered HTML [tags] (and/or [htmlDependencies()]).

Usage

1

Arguments

func

a function with no arguments that returns HTML tags and/or dependencies.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
myDivDep <- tagFunction(function() {
  if (isTRUE(getOption("useDep", TRUE))) {
    htmlDependency(
      name = "lazy-dependency",
      version = "1.0", src = ""
    )
  }
})
myDiv <- attachDependencies(div(), myDivDep)
renderTags(myDiv)
withr::with_options(list(useDep = FALSE), renderTags(myDiv))

htmltools documentation built on Jan. 23, 2021, 1:06 a.m.