Skip to content

dhollenbeck/handlebars-plugin-grouping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handlebars-plugin-grouping

A handlebars grouping iterator plugin to group collections into groups of definable size.

##Template Usage

An example template to render a collection of thumbnails into a bootstrap grid row of 6 thumbnails per row.

{{#grouping thumbnails 6}}
<div class="row">
	<div class="row-fluid" title="Row {{@index}} of {{@groups}} contains {{@size}} thumbnails.">
		{{#each this}}
			<div class="col-md-2">
				<img id="thumbnail-{{id}}" src="{{src}}" title="{{title}}"/>
			</div>
		{{/each}}
	</div>
</div>
{{/grouping}}

##Node.js

Installation:

npm install handlebars-plugin-grouping --save

Example:

var grouping = require('handlebars-plugin-grouping');
var exphbs  = require('express-handlebars');

var hbs = exphbs.create({
	helpers: {
		grouping: grouping
	}
});

##Browser

Load the script after the handlebars runtime.

<script type="text/javascript" src=".../handlebars.runtime.js"></script>
<script type="text/javascript" src=".../handlebars-plugin-grouping.js"></script>

##License MIT

About

Handlebars plugin to group collections into groups of definable size.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published