1.2.0 • Published 8 years ago

gulp-static-handlebars v1.2.0

Weekly downloads
70
License
ISC
Repository
github
Last release
8 years ago

Gulp Static Handlebars

Reads data, partials and helpers from asynchronous sources like a databases, file systems, or promises.

Build Status

Code Climate

Coverage Status

Dependencies

NPM version

Example with any A+ compatible promises library:

function getData() {
    return Promise.resolve({contents: 'whatever'});
}

function getHelpers() {
    return Promise.resolve({menu: function(options) { return 'menu!'; }});
}

function getPartials() {
    return Promise.resolve({header: '<header></header>', footer: '<footer></footer>'});
}

gulp.src('./app/index.hbs')
      .pipe(handlebars(getData(), {helpers: getHelpers(), partials: getPartials()}))
      .pipe(gulp.dest('./dist'));

Another example with vinyl pipes

gulp.src('./app/index.hbs')
      .pipe(handlebars({contents:"whatever"}, {
        helpers: gulp.src('./app/helpers/**/*.js'),
        partials: gulp.src('./app/partials/**/*.hbs')
      }))
      .pipe(gulp.dest('./dist'));

Get/Set Handlebars Instance

var MyHandlebars = handlebars.instance() // get Handlebars
handlebars.instance(MyHandlebars) // use another Handlebars instance

Install

npm install gulp-static-handlebars

Running Tests

To run the basic tests, just run mocha normally.

This assumes you've already installed the local npm packages with npm install.

To Do:

  • Support more handlebars options
1.2.0

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.13

9 years ago

1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago