An open API service indexing awesome lists of open source software.

https://github.com/helpers/handlebars-helper-isactive

{{isactive}} handlebars helper. Adds an 'active' class to the 'current page'. Class can be customized.
https://github.com/helpers/handlebars-helper-isactive

Last synced: 3 months ago
JSON representation

{{isactive}} handlebars helper. Adds an 'active' class to the 'current page'. Class can be customized.

Awesome Lists containing this project

README

          

# {{isActive}} [![NPM version](https://badge.fury.io/js/handlebars-helper-isactive.png)](http://badge.fury.io/js/handlebars-helper-isactive)

> Generate relative links from the "current page" to other dest pages.

## Installation

Use [npm](npmjs.org) to install the package: `npm i handlebars-helper-isactive`.

## Register the helper

In your project's Gruntfile, to register the helper add `handlebars-helper-isactive` to the `helpers` property in the [Assemble](http://assemble.io) task or target options:

```javascript
grunt.initConfig({
assemble: {
options: {
// the 'handlebars-helper-isactive' npm module must also be listed in
// devDependencies for assemble to automatically resolve the helper
helpers: ['handlebars-helper-isactive', 'foo/*.js']
},
files: {
'dist/': ['src/templates/*.hbs']
}
}
});
```
Alternatively, you can avoid defining the helper in the [Assemble](https://github.com/assemble/assemble) task options by adding module to both the `devDependencies` and `keywords` in your project's package.json.

```json
{
"name": "foo",
"version": "0.1.0",
"devDependencies": {
"handlebars-helper-isactive": "*"
},
"keywords": [
"handlebars-helper-isactive"
]
}
```

## Usage

With the helper registered, you may now begin using it in your templates.

_Examples also shows the [{{autolink}} helper](https://github.com/helpers/handlebars-helper-autolink)_.

**In a "page"**

```html
{{#each pages}}
{{data.title}}
{{/each}}
```

**In a "layout"**

```html
{{#each pages}}
{{../title}}
{{/each}}
```

Renders to:

```html
Foo
Bar
Baz
```

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](http://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License and Copyright

Licensed under the [MIT License](./LICENSE-MIT)
Copyright (c) Jon Schlinkert, contributors.