Skip to content
This repository has been archived by the owner on Jan 6, 2024. It is now read-only.

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

Notifications You must be signed in to change notification settings

Denis535/gulp-static-handlebars

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%