Skip to content

Commit 1ede560

Browse files
committed
first commit
0 parents  commit 1ede560

File tree

5 files changed

+170
-0
lines changed

5 files changed

+170
-0
lines changed

.gitignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
lib-cov
2+
*.seed
3+
*.log
4+
*.csv
5+
*.dat
6+
*.out
7+
*.pid
8+
*.gz
9+
10+
pids
11+
logs
12+
results
13+
14+
npm-debug.log
15+
node_modules
16+
tmp
17+
*.sublime-*

LICENSE-MIT

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2013 Jon Schlinkert
2+
3+
Permission is hereby granted, free of charge, to any person
4+
obtaining a copy of this software and associated documentation
5+
files (the "Software"), to deal in the Software without
6+
restriction, including without limitation the rights to use,
7+
copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the
9+
Software is furnished to do so, subject to the following
10+
conditions:
11+
12+
The above copyright notice and this permission notice shall be
13+
included in all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
OTHER DEALINGS IN THE SOFTWARE.

README.md

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# {{br}} [![NPM version](https://badge.fury.io/js/handlebars-helper-br.png)](http://badge.fury.io/js/handlebars-helper-br)
2+
3+
> Adds `<br>` tags to generated HTML. Great for prototyping.
4+
5+
## Installation
6+
7+
Use [npm](npmjs.org) to install the package: `npm i handlebars-helper-br`.
8+
9+
## Register the helper
10+
11+
The easiest way to register the helper with [Assemble](https://github.com/assemble/assemble) is to add the module to `devDependencies` and `keywords` in your project's package.json:
12+
13+
```json
14+
{
15+
"devDependencies": {
16+
"handlebars-helper-br": "*"
17+
},
18+
"keywords": [
19+
"handlebars-helper-br"
20+
]
21+
}
22+
```
23+
24+
Alternatively, to register the helper explicitly in the Gruntfile:
25+
26+
```javascript
27+
grunt.initConfig({
28+
assemble: {
29+
options: {
30+
// the 'handlebars-helper-br' npm module must also be listed in
31+
// devDependencies for assemble to automatically resolve the helper
32+
helpers: ['handlebars-helper-br', 'foo/*.js']
33+
},
34+
files: {
35+
'dist/': ['src/templates/*.hbs']
36+
}
37+
}
38+
});
39+
```
40+
41+
## Usage
42+
43+
With the helper registered, you may now begin using it in your templates.
44+
45+
```html
46+
{{br 5}}
47+
```
48+
49+
Renders to:
50+
51+
```html
52+
<br>
53+
<br>
54+
<br>
55+
<br>
56+
<br>
57+
```
58+
59+
## Author
60+
61+
**Jon Schlinkert**
62+
63+
+ [github/jonschlinkert](http://github.com/jonschlinkert)
64+
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
65+
66+
## License and Copyright
67+
68+
Licensed under the [MIT License](./LICENSE-MIT)
69+
Copyright (c) Jon Schlinkert, contributors.

index.js

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Handlebars Helpers: {{br}}
3+
* Copyright (c) 2013 Jon Schlinkert
4+
* Licensed under the MIT License (MIT).
5+
*/
6+
7+
8+
// Export helpers
9+
module.exports.register = function (Handlebars) {
10+
11+
'use strict';
12+
13+
/**
14+
* Add <br> tags to generated HTML
15+
* @xample: {{br 5}}
16+
*/
17+
Handlebars.registerHelper('br', function(count) {
18+
count = count - 1;
19+
20+
var content = [];
21+
for (var i = 0; i <= count; i++) {
22+
content.push('<br>');
23+
}
24+
return new Handlebars.SafeString(content.join(''));
25+
});
26+
};

package.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "handlebars-helper-br",
3+
"description": "{{br}} Handlebars helper. Adds `<br>` tags to generated HTML. Great for prototyping.",
4+
"version": "0.1.0",
5+
"homepage": "https://github.com/helpers/handlebars-helper-br",
6+
"author": {
7+
"name": "Jon Schlinkert",
8+
"url": "https://github.com/jonschlinkert"
9+
},
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/helpers/handlebars-helper-br.git"
13+
},
14+
"bugs": {
15+
"url": "https://github.com/helpers/handlebars-helper-br/issues"
16+
},
17+
"licenses": [
18+
{
19+
"type": "MIT",
20+
"url": "https://github.com/helpers/handlebars-helper-br/blob/master/LICENSE-MIT"
21+
}
22+
],
23+
"main": "./index.js",
24+
"dependencies": {
25+
"lodash": "~2.4.0"
26+
},
27+
"keywords": [
28+
"assemble",
29+
"assemblehelper",
30+
"br",
31+
"break",
32+
"handlebars helper",
33+
"handlebars",
34+
"helper"
35+
]
36+
}

0 commit comments

Comments
 (0)