# tpl_apply

> tpl_apply with handlebars

Latest version **1.0.5** (published 2016-06-07) · ISC license · 0 weekly downloads

## Install

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

## 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.0.5 |
| Published | 2016-06-07 |
| First published | 2015-01-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+9 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 10 |
| Maintainers | i5ting |

## Links

- npm: https://www.npmjs.com/package/tpl_apply
- Repository: https://github.com/i5ting/tpl_apply
- Issues: https://github.com/i5ting/tpl_apply/issues
- npm.io page: https://npm.io/package/tpl_apply

## Dependencies (4)

- [log1](https://npm.io/package/log1.md) ^1.0.7
- [handlebars](https://npm.io/package/handlebars.md) ^2.0.0
- [bufferhelper](https://npm.io/package/bufferhelper.md) ^0.2.0
- [object-assign](https://npm.io/package/object-assign.md) ^1.0.0

## Recent versions

- 1.0.5 (latest) — 2016-06-07
- 1.0.4 — 2016-05-27
- 1.0.3 — 2015-08-29
- 1.0.2 — 2015-01-23
- 1.0.1 — 2015-01-22
- 1.0.0 — 2015-01-22

## README

# tpl_apply

tpl_apply with handlebars

[![npm version](https://badge.fury.io/js/tpl_apply.svg)](http://badge.fury.io/js/tpl_apply)

## Install

	npm install --save tpl_apply
	
## Test

	npm test
	
## Usage

方式1 ：basic

```
var tpl = require('./index');


var source = process.cwd() + '/tpl.js'
var dest = process.cwd() + '/test/tpl.generate.js'


tpl.tpl_apply(source, {
	title: "My New Post", body: "This is my first post!"
}, dest);

```

方式2 ：with helpers

```
source = process.cwd() + '/tpl2.js'
dest = process.cwd() + '/test/tpl2.generate.js'

var Handlebars = require('handlebars');

Handlebars.registerHelper('list', function(items, options) {
  var out = "<ul>";

  for(var i=0, l=items.length; i<l; i++) {
    out = out + "<li>" + options.fn(items[i]) + "</li>";
  }

  return out + "</ul>";
});


tpl.tpl_apply_with_register_helper(Handlebars, source, {
  people: [
   {firstName: "Yehuda", lastName: "Katz"},
   {firstName: "Carl", lastName: "Lerche"},
   {firstName: "Alan", lastName: "Johnson"}
 ]
}, dest);
```

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