Emberman is a simple extension which allows you to easily serve an Ember app from your Middleman static site. It works by wrapping other excellent gems, along with some basic configuration, to get you quickly started.
- Auto-loads into Middleman's Asset Pipeline:
- Pre-compiles handlebars templates
- Uses production versions of Ember + Ember Data on
- Ignores ingredient files on
build, compiles into a single JS file
Add this line to your Middleman application's
# Gemfile gem 'emberman', '~> 0.1.4'
Activate the extension from your Middleman site's
# config.rb activate :emberman
Start the Middleman server.
For now, Ember's [and Emberman's] only other requirement is for jQuery to be present. This may change soon ;)
Emberman expects you to follow certain conventions in order to work its magic. However, some basic customization options are allowed:
Default directory structure
Ember assets (models, controllers, views, routes, etc.) should be placed in an
ember directory, and be named
templates. These templates should use the standard
.handlebars file extensions. E.g.:
Custom directory names
:js_dir property in your
Likewise, you can set a custom name for your Ember assets directory by passing an
:app_dir option when you activate the extension in your
Including the assets
Once you've setup the directories/files following the aforementioned conventions, you can include the assets in your main Ember app's JS file through Middleman's Asset Pipeline. Note that only the Runtime version of Handlebars is necessary, since the templates are pre-compiled. E.g.:
//= require jquery //= require handlebars.runtime //= require ember //= require ember-data //= require_self //= require ./ember/router //= require_tree ./ember/templates //= require_tree ./ember/adapters //= require_tree ./ember/components //= require_tree ./ember/controllers //= require_tree ./ember/models //= require_tree ./ember/routes //= require_tree ./ember/views
Using other versions of Ember, Ember Data or Handlebars
If you'd prefer to use different versions of Ember, Ember Data or Handlebars, add their corresponding source gems to your
# Gemfile gem 'ember-source', '1.8.1' gem 'ember-data-source', '0.14' gem 'handlebars-source', '1.3.0' gem 'emberman', '~> 0.1.4'