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.
- Host: GitHub
- URL: https://github.com/helpers/handlebars-helper-isactive
- Owner: helpers
- License: mit
- Created: 2013-12-05T13:26:31.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-03-11T18:19:35.000Z (almost 11 years ago)
- Last Synced: 2025-08-31T19:44:25.726Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 116 KB
- Stars: 6
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# {{isActive}} [](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:
## 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.