https://github.com/helpers/helper-copyright
Template helper for adding a basic, one-line copyright statement, with formatting appropriate for LICENSE/LICENSE-MIT or README templates. Should work with any Handlebars, Lo-Dash, underscore, or any template engine that allows helper functions to be registered.
https://github.com/helpers/helper-copyright
Last synced: 9 months ago
JSON representation
Template helper for adding a basic, one-line copyright statement, with formatting appropriate for LICENSE/LICENSE-MIT or README templates. Should work with any Handlebars, Lo-Dash, underscore, or any template engine that allows helper functions to be registered.
- Host: GitHub
- URL: https://github.com/helpers/helper-copyright
- Owner: helpers
- License: mit
- Created: 2014-11-10T06:06:16.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-08T19:59:09.000Z (about 9 years ago)
- Last Synced: 2025-04-03T06:37:51.716Z (10 months ago)
- Language: JavaScript
- Size: 40 KB
- Stars: 6
- Watchers: 4
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# helper-copyright [](https://www.npmjs.com/package/helper-copyright) [](https://npmjs.org/package/helper-copyright) [](https://npmjs.org/package/helper-copyright) [](https://travis-ci.org/helpers/helper-copyright)
> Template helper for adding a basic, one-line copyright statement, with formatting appropriate for LICENSE/LICENSE-MIT or README templates. Used with Verb, but should work with any Handlebars, Lo-Dash, underscore, or any template engine that allows helper functions to be registered.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save helper-copyright
```
## Usage
```js
var copyright = require('helper-copyright');
var handlebars = require('handlebars');
// the top-level export is a function that must be called, so you
// can optionally pass an options object when registering the helper
handlebars.registerHelper('copyright', copyright({linkify: true}));
```
## Example
Add a copyright statement, with author and year(s) in effect (verb templates):
```js
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
//=> Copyright (c) 2017 Jon Schlinkert
Copyright © 2014, 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
//=> Copyright (c) 2014-2017 Jon Schlinkert
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
//=> Copyright (c) 2017 [Jon Schlinkert](https://github.com/jonschlinkert)
```
## Examples
> This should work with any engine, here are a few examples
Given the following locals:
```js
var locals = {author: {name: 'Jon Schlinkert', url: 'https://github.com/jonschlinkert'}};
```
### [Lo-Dash](https://github.com/jonschlinkert/template)
As a helper:
```js
_.template('<%= copyright({author: author}) %>', locals, {
imports: {'helper-copyright': require('helper-copyright')}
});
//=> Copyright (c) 2017 Jon Schlinkert
```
As a mixin:
```js
_.mixin({'helper-copyright': require('helper-copyright')});
_.template('<%= copyright({author: author}) %>', locals);
//=> Copyright (c) 2017 Jon Schlinkert
```
### [template](https://github.com/jonschlinkert/template)
```js
template.helper('helper-copyright', require('helper-copyright'));
template.render('<%= copyright() %>', function(err, content) {
console.log(content);
//=> Copyright (c) 2017 Jon Schlinkert'
});
```
### [assemble](https://github.com/assemble/assemble)
```js
assemble.helper('helper-copyright', require('helper-copyright'));
assemble.render('{{copyright this}}', function(err, content) {
console.log(content);
//=> Copyright (c) 2017 Jon Schlinkert'
});
```
### [verb](https://github.com/jonschlinkert/verb)
```js
verb.helper('helper-copyright', require('helper-copyright'));
verb.render('Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).', function(err, content) {
console.log(content);
//=> Copyright (c) 2017 Jon Schlinkert'
});
```
### [handlebars](https://github.com/wycats/handlebars.js/)
```js
var handlebars = require('handlebars');
handlebars.registerHelper('helper-copyright', require('helper-copyright'));
handlebars.compile('{{copyright this}}')(locals);
//=> Copyright (c) 2017 Jon Schlinkert
```
## About
### Related projects
* [helper-license](https://www.npmjs.com/package/helper-license): Template helper for adding a formatted license statement based on the license type in package.json. | [homepage](https://github.com/helpers/helper-license)
* [helper-reflinks](https://www.npmjs.com/package/helper-reflinks): Async template helper for generating a list of markdown reference links. | [homepage](https://github.com/helpers/helper-reflinks)
* [helper-related](https://www.npmjs.com/package/helper-related): Template helper for generating a list of links to the homepages of related GitHub/npm projects. | [homepage](https://github.com/helpers/helper-related)
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb)
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 53 | [jonschlinkert](https://github.com/jonschlinkert) |
| 1 | [ierceg](https://github.com/ierceg) |
| 1 | [mightyiam](https://github.com/mightyiam) |
### Building docs
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install -g verb verb-generate-readme && verb
```
### Running tests
Install dev dependencies:
```sh
$ npm install -d && npm test
```
### Author
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
### License
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.3.0, on January 08, 2017._