# metalsmith-handlebars

> A basic handlebars implimentation for metalsmith

Latest version **1.1.0** (published 2018-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install metalsmith-handlebars
pnpm add metalsmith-handlebars
yarn add metalsmith-handlebars
bun add metalsmith-handlebars
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-01-09 |
| First published | 2017-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Robert Bollons |
| Maintainers | robbollons |

## Links

- npm: https://www.npmjs.com/package/metalsmith-handlebars
- Repository: https://github.com/RobBollons/metalsmith-handlebars
- Homepage: https://github.com/RobBollons/metalsmith-handlebars#readme
- Issues: https://github.com/RobBollons/metalsmith-handlebars/issues
- npm.io page: https://npm.io/package/metalsmith-handlebars

## Dependencies (2)

- [minimatch](https://npm.io/package/minimatch.md) ^3.0.3
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.6

## Recent versions

- 1.1.0 (latest) — 2018-01-09
- 1.0.0 — 2017-04-17

## README

# metalsmith-handlebars
> A basic implimentation of handlebars for metalsmith

I made this plugin as an alternative to metalsmith-jstransformer so that the handlebars inline templating functionality can be leveraged. This means you can use handlebars like this:

##### `src/index.hbs`
```html
---
title: Home
---
{{#> main-layout }}
    {{#* inline "content-block" }}
        Hello, welcome to my metalsmith static site.
    {{/inline}}
{{/main-layout}}

```
##### `partials/main-layout.hbs`
```html
<html>
    <head>
    </head>
    <body>
        {{>content-block}}
    </body>
</html>

```

The plugin can be used in the metalsmith 'use' definition like this:
```js
const Metalsmith = require('metalsmith'),
      handlebars = require('metalsmith-handlebars');

Metalsmith(__dirname)
    .use(handlebars({
        pattern: '**/*.hbs', // defaults to '**'
        partials: 'partials', // defaults to 'partials' in the root
        targetExtension: 'html', // defaults to html
        globals: { // defaults to an empty object
            foo: 'bar'
        }
    }))
    .build(function(err) {
        if (err) throw err;
        console.log('Build finished!');
    });
```

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