# brio

> View building blocks

Latest version **0.1.2** (published 2014-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install brio
pnpm add brio
yarn add brio
bun add brio
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2014-09-15 |
| First published | 2013-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Matt Brennan |
| Maintainers | quarterto |
| Keywords | layout, frontmatter, cson, view, gusto |

## Links

- npm: https://www.npmjs.com/package/brio
- Repository: https://github.com/quarterto/Brio
- Issues: https://github.com/quarterto/Brio/issues
- npm.io page: https://npm.io/package/brio

## Dependencies (5)

- [flat](https://npm.io/package/flat.md) ^1.2.1
- [broca](https://npm.io/package/broca.md) ^0.1.0
- [deepmerge](https://npm.io/package/deepmerge.md) ^0.2.7
- [es6-symbol](https://npm.io/package/es6-symbol.md) ^0.1.0
- [bunch-of-errors](https://npm.io/package/bunch-of-errors.md) 0.0.0

## Recent versions

- 0.1.2 (latest) — 2014-09-15
- 0.1.1 — 2014-08-09
- 0.0.0 — 2013-11-02

## README

# Brio [![Build Status](https://travis-ci.org/quarterto/Brio.svg?branch=v0.1.1)](https://travis-ci.org/quarterto/Brio)

Templated layout builders.

```
npm install brio
```

![brio](http://irecommend.ru.q5.r-99.com/sites/default/files/product-images/9504/11534.jpg)

## Usage
(Pretending that Javascript has multiline strings)

```javascript
var brio = require('brio'), handlebars = require('handlebars');

var pages = brio(handlebars, {
	base: `<!doctype html>
	<html>
		<head>
			<title>{{page.title}}</title>
		</head>
		<body>
		{{{body}}}
		</body>
	</html>`,
	page: `---
	layout: 'base'
	---
	<h1>{{page.title}}</h1>
	<main>
	{{{body}}}
	</main>`,
	site: {
		home: `---
		title: 'Home',
		layout: 'page'
		---

		Welcome!`,
		post: `---
		title: 'Post'
		layout: 'page'
		---

		<h2>{{post.title}}</h2>
		<article>{{post.content}}</article>`
	}
});

pages('site.home', {}); /*⇒ <!doctype html>
	<html>
		<head>
			<title>Home</title>
		</head>
		<body>
		<h1>Home</h1>
			<main>
			Welcome!
			</main>
		</body>
	</html>
*/

pages('site.post', {post: {title: 'Hello world', content: 'Lorem ipsum dolor sit amet'}); /*⇒ <!doctype html>
	<html>
		<head>
			<title>Post</title>
		</head>
		<body>
		<h1>Post</h1>
			<main>
			<h2>Hello world</h2>
			<article>Lorem ipsum dolor sit amet</article>
			</main>
		</body>
	</html>
*/

```

## API
#### `brio :: (Template → Params → String) → Tree String Template → Path → Params → String`
Takes a templater, a tree of templates, a path to a template, some params and spits out a compiled string.
#### Templaters
Are any curried function taking a template and some parameters and returning a string. Handlebars fits nicely, as does `_.template`.

## Licence
MIT. &copy; 2014 Matt Brennan.

---
_Source: https://npm.io/package/brio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
