@altaresoftware/quorum
v0.1.3
Published
A templating engine with includes and blocks. It's nicer than raw HTML.
Maintainers
Readme
Quorum
Templating engine with includes and blocks.
Installation
npm install @altaresoftware/quorumExamples
Basic Example
<!-- index.quo -->
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
</head>
<body>
<h1><%= heading %></h1>
<% for (let i = 0; i < items.length; i++) { %>
<div><%= items[i] %></div>
<% } %>
</body>
</html>Includes
<!-- header.quo -->
<header>
<nav>
<a href="/">Home</a>
<a href="/about">About</a>
</nav>
</header>
<!-- index.quo -->
<!DOCTYPE html>
<html>
<body>
<% include 'header.quo' %>
<main>Content here</main>
</body>
</html>Blocks
<!-- layout.quo -->
<!DOCTYPE html>
<html>
<head>
<% block('head') %>
</head>
<body>
<% block('content') %>
</body>
</html>
<!-- page.quo -->
<% include 'layout.quo' %>
<% block head %>
<title>My Page</title>
<% /block head %>
<% block content %>
<h1>Welcome</h1>
<% /block content %>Configuration
Create a quorum.config.js file:
export default {
entry: 'index.quo',
outDir: 'dist',
assetsDir: 'assets',
esbuild: {
minify: true,
bundle: true,
format: 'esm',
},
devServer: {
port: 3000,
open: true,
},
}Commands
quorum build # Build templates and assets
quorum watch # Build and watch for changes
quorum dev # Start development server