create-frame

WebJar for create-frame

License

License

MIT
GroupId

GroupId

org.webjars.bowergithub.jonschlinkert
ArtifactId

ArtifactId

create-frame
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

create-frame
WebJar for create-frame
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/jonschlinkert/create-frame

Download create-frame

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.jonschlinkert/create-frame/ -->
<dependency>
    <groupId>org.webjars.bowergithub.jonschlinkert</groupId>
    <artifactId>create-frame</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.jonschlinkert/create-frame/
implementation 'org.webjars.bowergithub.jonschlinkert:create-frame:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.jonschlinkert/create-frame/
implementation ("org.webjars.bowergithub.jonschlinkert:create-frame:1.0.0")
'org.webjars.bowergithub.jonschlinkert:create-frame:jar:1.0.0'
<dependency org="org.webjars.bowergithub.jonschlinkert" name="create-frame" rev="1.0.0">
  <artifact name="create-frame" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.jonschlinkert', module='create-frame', version='1.0.0')
)
libraryDependencies += "org.webjars.bowergithub.jonschlinkert" % "create-frame" % "1.0.0"
[org.webjars.bowergithub.jonschlinkert/create-frame "1.0.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.webjars.bowergithub.jonschlinkert : define-property jar [0.2.5,0.3)
org.webjars.bowergithub.jonschlinkert : extend-shallow jar [2.0.1,3)
org.webjars.bowergithub.jonschlinkert : isobject jar [3.0.0,4)
org.webjars.bowergithub.jonschlinkert : lazy-cache jar [2.0.2,3)

Project Modules

There are no modules declared in this project.

create-frame NPM version NPM downloads Build Status

Easily add private variables to handlebars block helpers.

Install

Install with npm:

$ npm install --save create-frame

Usage

var createFrame = require('create-frame');

Example

Create private variables from options hash arguments.

Template

The @post variable inside the block is created by the post hash argument. So the context of @post is the this object that is passed to the block.

{{#block post=this}}
<h1>{{@post.title}}</h1>
{{/block}}

Helper

The following helper uses createFrame, then it extends the "frame" with hash arguments.

handlebars.registerHelper('block', function (options) {
  var frame = createFrame(options.data);
  // extend the frame with hash arguments
  frame.extend(options.hash);
  return options.fn(options, {data: frame});
});

var fn = handlebars.compile(str);
fn({title: 'My Blog Post'});

About

Related projects

Contributing

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

Building docs

(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)

To generate the readme and API documentation with verb:

$ npm install -g verb verb-generate-readme && 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 July 21, 2016.

Versions

Version
1.0.0