compile_tailwindcss {shiny.tailwind}R Documentation

Starts the 'TailwindCSS' CLI

Description

See also tailwind docs

Usage

compile_tailwindcss(
  infile,
  outfile,
  watch = FALSE,
  minify = FALSE,
  content = ".",
  tailwindcss = NULL,
  verbose = FALSE
)

Arguments

infile

the 'TailwindCSS' file (eg containing the ⁠@tailwind⁠ directives). Relative to basedir

outfile

the target css file, where tailwind will write the css to. Relative to basedir

watch

if the files should be continuously monitored (versus only compile the css once), default is False

minify

if the code should be minified, default is FALSE

content

content paths to remove unused classes, default is current dir

tailwindcss

name and path to the executable

verbose

print information

Value

the outfile invisibly

See Also

install_tailwindcss_cli

Examples

if (interactive()) {
  temp <- tempdir()
  owd <- setwd(temp)

  infile <- "custom.css"
  writeLines("@tailwind base;", infile)
  outfile <- "out.css"

  # file.copy(system.file("examples", "01-Old_Faithful", "app.R", package = "shiny.tailwind"),
  #           "app.R", overwrite = TRUE)

  # write a mini shiny UI
  writeLines("
    library(shiny)
    div(class = \"page-div\",
        div(class = \"w-full text-center py-12\",
            h1(\"Hello World\")
        )
    )", "app.R")

  tailwindcss <- NULL # can be set to the executable file
  compile_tailwindcss(infile, outfile, tailwindcss = tailwindcss)
  cat(paste(readLines(outfile)[1:20], collapse = "\n"))

  setwd(owd)
}

[Package shiny.tailwind version 0.2.2 Index]