assemble-helper-assets-manifest

This package provides a custom helper for Handlebars that Assemble can use.

MIT License

Downloads
8
Stars
0
Committers
1

Assemble Helper Assets Manifest

This package provides a custom helper for Handlebars that Assemble can use.

Installation

npm install assemble-helper-assets-manifest --save

Setup with Assemble

After you install this package, you need to tell Assemble about it. You do that by adding the package name to the helpers array in your config.

You also need to specify assetsManifest so that the helper knows where to look for your assets manifest file.

Example config

assemble: {
  options: {
    helpers: [ 'assemble-helper-assets-manifest' ],
    manifestPath: path.join(__dirname, 'manifest.json')
  }
}

Setup with Handlebars

var Handlebars = require('handlebars');
var AssetsManifestHelper = require('assemble-helper-assets-manifest');

AssetsManifestHelper.register(Handlebars, {
  manifestPath: path.join(process.cwd(), 'public', 'assets', 'manifest.json'),
  prefix: '/assets/'
});

Using the Handlebars helper

<img src="{{assetsManifest 'images/photo.jpg'}}" />
{{#each images}}
  <img src="{{assetsManifest this.src}}" />
{{/each}}