Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handlebars-helper-repeat

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

handlebars-helper-repeat

Repeat the encapsulated block of content _n_ times.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
863
decreased by-9.16%
Maintainers
1
Weekly downloads
 
Created
Source

{{repeat}} NPM version

Repeat the encapsulated block of content n times.

If you find a bug or have a feature request, please create an issue.

Installation

Use npm to install the package: npm i handlebars-helper-repeat.

Register the helper

The easiest way to register the helper with Assemble is to add the module to devDependencies and keywords in your project's package.json:

{
  "devDependencies": {
    "handlebars-helper-repeat": "*"
  },
  "keywords": [
    "handlebars-helper-repeat"
  ]
}

Alternatively, to register the helper explicitly in the Gruntfile:

grunt.initConfig({
  assemble: {
    options: {
      // the 'handlebars-helper-repeat' npm module must also be listed in
      // devDependencies for assemble to automatically resolve the helper
      helpers: ['handlebars-helper-repeat', 'foo/*.js']
    },
    files: {
      'dist/': ['src/templates/*.hbs']
    }
  }
});

Usage Examples

{{#repeat 10}}
   {{> button }}
{{/repeat}}

Using @index in templates:

{{#repeat 500}}
<div id="example-{{@index}}">
  <button>Button {{@index}}</button>
</div>
{{/repeat}}

Example usage with Assemble

Besides the handlebars-helpers library, which includes more than 120 helpers, Here are some related projects you might be interested in from the Assemble core team.

  • handlebars-helper-aggregate: {{aggregate}} handlebars helper. inlines content from multiple files optionally using wildcard (globbing/minimatch) patterns. uses YAML front matter as context for each file. optionally pass in a sorting function.
  • handlebars-helper-autolink: {{autolink}} handlebars helper. Generate relative links from the "current page" to other dest pages.
  • handlebars-helper-br: {{br}} Handlebars helper. Adds <br> tags to generated HTML. Great for prototyping.
  • handlebars-helper-compose: {{compose}} handlebars helper. Similar to {{aggregate}}, but this is a block expression helper that inlines content from multiple files differently, extracting YAML front matter to pass to context for each file. Optionally use wildcard (globbing/minimatch) patterns. Accepts compare function as 3rd parameter for sorting inlined files.
  • handlebars-helper-condense: Remove extra newlines from HTML content.
  • handlebars-helper-disqus: {{disqus}} Handlebars helper. Simplifies adding Disqus comments to your site.
  • handlebars-helper-eachitems: {{eachItems}} handlebars helper.
  • handlebars-helper-ghbtns: {{ghbtn}} handlebars helper. Add github buttons (http://ghbtns.com) to your site.
  • handlebars-helper-include: Handlebars helper, alternative to built-in partials. Similar to handlebars-helper-partial, but this helper will allow wildcard (glob) patterns. Like Assemble itself, this helper will automatically determine the correct context to use, or a context may be explicitly passed in as a second parameter.
  • handlebars-helper-isActive: {{isactive}} handlebars helper. Adds an 'active' class to the 'current page'. Class can be customized.
  • handlebars-helper-jade: {{jade}} handlebars helper, for converting basic Jade templates to HTML.
  • handlebars-helper-less: {{less}} handlebars helper. This helper allows you to use LESS inside style tags in your HTML. By default, the resulting CSS will be rendered inside the <style>...</style> tags of the rendered HTML, but you may alternatively define a destination path using the dest hash option of the helper.
  • handlebars-helper-lorem: {{lorem}} handlebars helper, for generating lorem lorem placeholder text.
  • handlebars-helper-minify: {{minify}} handlebars helper, for minification of HTML with html-minifier.
  • handlebars-helper-moment: {{moment}} handlebars helper. Combines the powers of Assemble, Handlebars.js and Moment.js into a great helper to master time.
  • handlebars-helper-not: {{not}} handlebars helper. Conditionally render a block if the condition is false. This block helper is really just a semantic alternative to {{isnt}}
  • handlebars-helper-paginate: {{paginate}} handlebars helper. Made for Assemble, the static site generator for Node.js, Grunt.js and Yeoman.
  • handlebars-helper-partial: Handlebars helper, alternative to built-in partials. Like Assemble itself, this helper will automatically determine the correct context to use, or a context may be explicitly passed in as a second parameter.
  • handlebars-helper-pkg: {{pkg}} handlebars helper, for retrieving a value from your project's package.json
  • handlebars-helper-post: {{post}} handlebars helper, for including a post, or a list of posts.
  • handlebars-helper-prettify: {{prettify}} handlebars helper, for formatting ("beautifying") HTML, CSS and JavaScript.
  • handlebars-helper-process: {{process}} handlebars helper, for processing raw templates in included content, with the correct context
  • handlebars-helper-rel: Handlebars helper for generating a relative link from the current page to the specified page.
  • handlebars-helper-slugify: Convert strings into URL slugs.
  • handlebars-helper-track: {{track}} handlebars helper. Simplify the process of adding Google analytics tracking codes to your web projects.
  • handlebars-helper-twitter: Add {{tweet}} and {{follow}} buttons using handlebars helpers.
  • handlebars-helper-uml: Embed UML diagrams in your handlebars template using www.websequencediagrams.com

Visit assemble.io/plugins for more information about Assemble plugins.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt, and build the documentation with grunt-readme.

Authors

Jon Schlinkert

Brian Woodward

Release History

  • 2014-01-12   v0.2.0   Adds {{@index}} to context. Adds more documentation. Adds Digits as a dependency, for padding generated numbers (@index). Adds basic tests and fixtures.
  • 2013-09-16   v0.1.0   First commmit.

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license


This file was generated by grunt-readme on Sunday, January 12, 2014.

Keywords

FAQs

Package last updated on 12 Jan 2014

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