Socket
Socket
Sign inDemoInstall

helper-license

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helper-license

Template helper for dynamically generating a basic, one-line license statement based on the given context, e.g. `Released under the MIT license`. Should work with any Handlebars, Lo-Dash, underscore, or any template engine that allows helper functions to


Version published
Weekly downloads
122
increased by48.78%
Maintainers
1
Weekly downloads
 
Created
Source

helper-license NPM version Build Status

Template helper for dynamically generating a basic, one-line license statement based on the given context, e.g. Released under the MIT license. Should work with any Handlebars, Lo-Dash, underscore, or any template engine that allows helper functions to be registered.

Install with npm

npm i helper-license --save

Usage example

Add a basic license statement to a document with verb:

{%= license() %}
//=> Released under the MIT license

{%= license({linkify: true}) %}
//=> Released under the [MIT](https://github.com/jonschlinkert/helper-license/blob/master/LICENSE-MIT) license

Other engines/apps

Add a basic license statement

var pkg = require('./package.json');

// handlebars
Handlebars.compile('{{license this}}')(pkg);
// lo-dash
_.template('<%= license({licenses: licenses}) %>', )
// verb
verb.render('{%= license({licenses: licenses}) %}', pkg);

// all result in:
//=> Released under the MIT license

Linkify:

_.template('<%= license({licenses: licenses, linkify: true}) %>', pkg);
//=> Released under the [MIT](https://github.com/jonschlinkert/helper-license/blob/master/LICENSE-MIT) license

Registering the helper

This should work with any engine, here are a few examples to get you started

template

template.helper('license', require('helper-license'));

assemble

assemble.helper('license', require('helper-license'));

verb

verb.helper('license', require('helper-license'));

handlebars

var handlebars = require('handlebars');
handlebars.registerHelper('license', require('helper-license'));
  • helper-copyright: Template helper for adding a basic, one-line copyright statement, with… more
  • helper-reflinks: Template helper for generating a list of markdown formatted reference… more
  • helper-related: Template helper for generating a list of links to the… more
  • template-helpers: Generic JavaScript helpers that can be used with any template… more
  • verb: Verb makes it dead simple to generate markdown documentation, using… more

Running tests

Install dev dependencies:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb-cli on April 23, 2015.

FAQs

Package last updated on 23 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc