https://github.com/tomi77/handlebars-helpers-underscore.string
Wrap underscore.string functions to Handlebars helpers
https://github.com/tomi77/handlebars-helpers-underscore.string
handlebars handlebars-helpers string-manipulation
Last synced: 17 days ago
JSON representation
Wrap underscore.string functions to Handlebars helpers
- Host: GitHub
- URL: https://github.com/tomi77/handlebars-helpers-underscore.string
- Owner: tomi77
- License: mit
- Created: 2014-09-08T06:21:17.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-07-07T07:35:09.000Z (almost 6 years ago)
- Last Synced: 2025-02-15T20:05:03.297Z (5 months ago)
- Topics: handlebars, handlebars-helpers, string-manipulation
- Language: JavaScript
- Size: 62.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/tomi77/handlebars-helpers-underscore.string)
[](https://coveralls.io/r/tomi77/handlebars-helpers-underscore.string)
[](https://codeclimate.com/github/tomi77/handlebars-helpers-underscore.string)
[](https://david-dm.org/tomi77/handlebars-helpers-underscore.string)
[](https://david-dm.org/tomi77/handlebars-helpers-underscore.string?type=dev)
[](https://david-dm.org/tomi77/handlebars-helpers-underscore.string?type=peer)
handlebars-helpers-underscore.string
====================================Wrap [underscore.string](http://gabceb.github.io/underscore.string.site/) functions to [Handlebars](http://handlebarsjs.com/) helpers
## Installation
Via ``bower``:
~~~bash
bower install handlebars-helpers-underscore.string
~~~Via ``npm``:
~~~bash
npm install handlebars-helpers-underscore.string
~~~## Usage
In ``node``:
~~~js
Handlebars = require('handlebars');
require('handlebars-helpers-underscore.string');var source = "
Hello, my name is {{name}}. I am from {{underscored hometown}}. I have " +
" +
"{{kids.length}} kids:
"
- {{#kids}}
- {{name}} is {{age}} {{/kids}}
var template = Handlebars.compile(source);
var data = { "name": "Alan", "hometown": "Somewhere, TX",
"kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]};
var result = template(data);
// Would render:
//
Hello, my name is Alan. I am from somewhere,_tx. I have 2 kids:
//
- Jimmy is 12
- Sally is 4
//
//
//
~~~
In ``webpack`` remember to set `node.fs` to `empty`.