handlebars-helper-compose
Version:
{{compose}} handlebars helper. Inlines content from multiple files optionally using wildcard (globbing/minimatch) patterns, extracts YAML front matter to pass to context for each file. Accepts compare function as 3rd parameter for sorting inlined files. Good for blog posts, chapters, etc.
40 lines (36 loc) • 1.46 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title from PAGE toc-sorting.hbs</title>
<link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.min.css">
</head>
<body>
<div class="container bs-docs-container">
<h1>Title from PAGE toc-sorting.hbs</h1>
<!-- post -->
<p>
<h2>Variables from the <code>data</code> context.</h2>
<span class="filename">filename: middle-file-chapter-3</span>
<span class="intro">intro: Chapter 3</span>
<span class="chapter">chapter: 3</span>
<span class="index">index: 2</span>
<span class="custom">custom: 1</span>
<!-- chapter -->
<h2>Variables from the <code>data</code> context.</h2>
<span class="filename">filename: something-random-chapter-1</span>
<span class="intro">intro: Chapter 1</span>
<span class="chapter">chapter: 1</span>
<span class="index">index: 3</span>
<span class="custom">custom: 2</span>
<!-- chapter -->
<h2>Variables from the <code>data</code> context.</h2>
<span class="filename">filename: before-another-chapter-2</span>
<span class="intro">intro: Chapter 2</span>
<span class="chapter">chapter: 2</span>
<span class="index">index: 1</span>
<span class="custom">custom: 3</span>
</p>
</div>
</body>
</html>