Introduction
Basics
Boxwood is a server side HTML engine, which is using JS templates.
const { html, head, title, body, h1 } = require('boxwood')
module.exports = function app () {
return html([
head([
title('boxwood template')
]),
body([
h1('Hello, world!')
])
])
}
js
Using JS
- component composition,
- using the rich npm ecosystem,
- usage of existing linters, formatters and minifiers,
- generation of valid and optimized HTML
- scoped CSS per component, which is used for deducing critical css for given page,
- easy testing of all components,
- the possibility of using TS or other languages that generate JS
Installation
npm install boxwood
bash
Start
const { compile } = require('boxwood')
async function render (html) {
const { template } = await compile(html)
return template({ foo: 'bar' })
}
js