# gulp-handlebars-all

> A gulp plugin for compiling handlebars templates to either JS or HTML

Latest version **0.1.1** (published 2016-01-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-handlebars-all
pnpm add gulp-handlebars-all
yarn add gulp-handlebars-all
bun add gulp-handlebars-all
```

## 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.1 |
| Published | 2016-01-05 |
| First published | 2016-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Guangyao LIU |
| Maintainers | brilliun |
| Keywords | gulp, handlebars |

## Links

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

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^6.0.3
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.7
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.5

## Recent versions

- 0.1.1 (latest) — 2016-01-05
- 0.1.0 — 2016-01-05

## README

# gulp-handlebars-all

A gulp plugin for compiling handlebars templates to either JS or HTML.

## Install

```
$ npm install --save gulp-handlebars-all
```

## Usage

```javascript
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var hbsAll = require('gulp-handlebars-all');

gulp.task('compileToJS', function() {
   gulp.src('runtimeTemplate/*.hbs')
  .pipe(hbsAll('js'))
  .pipe($.declare({
    namespace: 'app.templates',
    noRedeclare: true,
  }))
  .pipe($.concat('runtimeTemplate.js'))
  .pipe(gulp.dest('dest/js'));
});

gulp.task('compileToHTML', function() {
   gulp.src('template/*.hbs')
  .pipe(hbsAll('html', {
    context: {foo: 'bar'},

    partials: ['partials/*.hbs'],

    helpers: {
      capitals : function(str) {
        return str.toUpperCase();
      }
    }
  }))
  .pipe(gulp.dest('dest/tpl'));
});
```

##API

### gulp-handlebars-all(outputType, options)

#### outputType

* ```js```: output to precompiled js function used with handlebars runtime
* ```html```: output to compiled HTML

#### options
Options are passed through to handlebars, except for the following:

* context: context object used for compiling to HTML
* partials: paths of partial files to be registered before compiling
* helpers: helper functions to be registered before compiling

## License

[MIT](http://opensource.org/licenses/MIT) © Guangyao LIU

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