CSS style sheet builder

Usage

sheet <- StyleSheet$new()
sheet <- css_stylesheet()

sheet$append(style)
sheet$remove(3)
sheet$add('h1', color = 'blue')
sheet$as_character()
new_sheet <- sheet$copy()

Methods

$new(...)

Initialise a stylesheet

...all arguments treated as Style objects and added to the style sheet

$append(...)

Append Style objects to this StyleSheet

...all arguments treated as Style objects and added to the style sheet

$remove(indices)

Remove Style objects from this StyleSheet by index.

indicesindices of Style objects to remove

$add(..., selector = NULL)

Creates a Style object and adds it to the StyleSheet. Returns the newly created Style.

...name/value properties
selectorIf given, then used as the the selector for this style. If not given, then the first unnamed argument in ... is interpreted as the character string for the selector.

$as_character()

Convert StyleSheet to a character string.

$print()

Print StyleSheet to terminal.

$copy()

Copy StyleSheet.

Examples

if (FALSE) { marsha <- css_style('#marsha')$ update(marsha = 'marsha')$ update(ptag$display$none, width = "100%") sheet <- StyleSheet$new(marsha) }