Socket
Book a DemoInstallSign in
Socket

helper-example

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helper-example

Opinionated template helper that inserts a code example from a filepath.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

helper-example NPM version Build Status

Opinionated template helper that inserts a code example from a filepath.

Install

Install with npm:

$ npm install helper-example --save

Usage

Register the helper with app (verb, assemble or templates);

app.helper('example', require('helper-example'));

To use the helper, pass the filepath of the code example to inject and the name of the module as the second argument:

<%= example("examples/foo.js", "foo-bar-baz") %>

If the contents of foo.js is something like this:

var app = require('./');

function foo(a, b, c) {
  //=> do stuff with a, b, and c
  return app(a, b, c);
}
foo('one', 'two', 'three');

The require('./') statement is converted to require('helper-example'):

var app = require('helper-example');

function foo(a, b, c) {
  //=> do stuff with a, b, and c
  return app(a, b, c);
}
foo('one', 'two', 'three');
  • assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… more | homepage
  • generate: Fast, composable, highly extendable project generator with a user-friendly and expressive API. | homepage
  • templates: System for creating and managing template collections, and rendering templates with any node.js template engine.… more | homepage
  • update: Easily keep anything in your project up-to-date by installing the updaters you want to use… more | homepage
  • verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage

Contributing

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

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.

This file was generated by verb, v0.9.0, on February 26, 2016.

Keywords

example

FAQs

Package last updated on 26 Feb 2016

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