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

handlebar-rider

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebar-rider

Compiles/watches a directory of handlebar templates files and precompiles into single js output file

  • 0.1.10
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

handlebar-rider

================

This is a module and command line tool that will compile/watch a handlebars template directory and pre-compile any handlebars template files then concatenate them into a single javascript file.

The directory structure you use will namespace the templates with ['directory/template'] as with JST et all

Install:

npm install -g handlebar-rider

Command line usage:

Command Line Usage: 

Options:
  -i, --in        Specify an input templates directory                            [default: "./app/handlebars/"]
  -o, --out       Specify an output file into which templates are compiled        [default: "./public/javascript/templates.js"]
  -w, --watch     Watch your handlebars files and compile when changes occur      [default: false]
  -r, --readable  Make the output more readable by avoiding default minification  [default: false]
  

npm module usage

	hbr = require('handlebar-rider')
	hrb.configure({
	  in: '/path/to/your/templates/'
	  out: '/path/to/output.js',
	  minify: false
	})
	hbr.compile()
	hbr.watch()
			

Run-time usage example:

html_output = Handlebars.templates['users/view'](data)

Partial Support/Conventions:

There are two methods for using partials within your templates:

1. Global partials

If you a directory within your templates directory, aptly called "partials", the handlebars files will be pre compile and become available in your templates as partial_name

2. Scoped partials

If you prefix your template file name with an underscore, you can can access it as directory_partial

Example directory structure:

templates 
  -- users
      - _list.hb
      - _form.hb
      - edit.hb
      - view.hb
  
  -- partials
      - photo_uploader.hb

And usage:

<h1>Edit User</h1>
{{> users_list}}
{{> users_form}}
{{> photo_uploader}}

FAQs

Package last updated on 04 Aug 2012

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