node package manager

ember-template-middleware

Ember template compiler middleware.

Ember template compiler middleware.

  • Render ember templates in node js as middleware
  • Outputs AMD and Ember.TEMPLATE objects

To activate middleware require ember-template-compiler and then configure.

var compiler = require('ember-template-compiler');

A simple setup will look something like:

app.use(compiler.middleware({
	src: 	 	__dirname + '/handlebars',
	dest: 	 	__dirname,
	format:		'AMD'
}));
  • src: Hbs file folder. Do not include __dirname if origin not defined, REQUIRED
  • dest: Output destination. Do not include __dirname if origin not defined, REQUIRED
  • origin: Origin directory, DEFAULT: false
  • force: Force compile, DEFAULT: false
  • format: Output format. Either 'AMD' or null. null outputs an Ember.TEMPLATES property
  • namePrefix: Prefix for template name
  • pathInName: Include path in name, DEFAULT: true

If the origin is defined. src and dest will be relative to it.

app.use(compiler.middleware({
	src: 	 	'/js/app/handlebars',
	dest: 	 	'/js/app/templates',
	origin:  	'/var/www/frontend/public',
	namePrefix: 'app/templates',
	format:  	'AMD',
	force: 		true
}));

Copyright © 2013 Jim Hall

Licensed under the MIT License