Pugger
Use the pug templating engine with ambiorix.
Installation​
# install.packages("remotes")
remotes::install_github("devOpifex/pugger")
Example​
Render the following test.pug
file.
doctype html
html(lang="en")
head
title= pageTitle
script(type='text/javascript').
if (foo) bar(1 + 5);
body
h1 Pug - node template engine
#container.col
if iUsePugger
p You are amazing
else
p Get on it!
p.
Pug is a terse and simple templating language with a
strong focus on performance and powerful features.
With the following app.
library(ambiorix)
app <- Ambiorix$new()
app$use(pugger::pugger())
app$get("/", \(req, res) {
res$render(
"test.pug",
list(
iUsePugger = TRUE
)
)
})
app$start()
Outside of Ambiorix
Just use renderer
.
pugger::renderer(
"test.pug",
list(
iUsePugger = TRUE
)
)