Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

handlebars-require

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-require

a helper that inject helper components into a template

latest
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Require Helper

Require helper allows for including ephemeral or "components" into your application. Right now it is mostly a experiment to see if this typeof data into Handlebar templates. The api is a bit rough right now but that should be ephemeral as well.

Usage

To get the helper injected into your instance of Handlebars require in the module and pass it the current require function and Handlebars.

var 
  Handlebars = require('handlebars');

require('handlebars-require')(require, Handlebars); 
// now you should have the require helper

In the template now you can do this.

{{require './path/to/component'}} {{!-- This is a referance to a js file --}}
<div class="component-container">
  {{MyComponent property=value}} {{!-- exported value is based of contructor.name --}}
</div>

Setting ephemeral helper name

{{require './path/to/component' exports="NamedComponent"}}
{{NamedComponent property=value}} {{!-- exports changed the ref --}}

What is a Component

Right now in the simplist form a component is a contructor that has a render function. This is loosly based off of Backbone views.

FAQs

Package last updated on 23 Mar 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