gamepoet/sinatra-ember — pull request #2 by convandesign (2012-08-25 08:48:07+00:00)
Title: Multiple directories

Not sure if this is best way to handle this, but I needed sinatra-ember to accomplish two things that it wasn't: traverse multiple directories (was throwing errors), and add those directories to the template name so that template names across directories don't have to be unique.

My approach changes the api slightly.

Usage:
register Sinatra::Ember
ember {

templates '/templates.js', ['app/templates']

}

Where ['app/templates'] will require the entire tree within the templates/ directory.

If this is the tree:

- app
- templates
- posts
- view.handlebars
- users
- view.handlebars
- delete.handlebars

Then the corresponding template names will be:
posts/view
users/view
users/delete

Oh, and I also added support for using .handlebars, .hjs, or .hbs extensions for templates, as there doesn't seem to be a standard.