Ember::Middleman
ember-middleman supports using Ember.js with Middleman in easily. You can use this with hamlbars if you like.
This gem is inspired by ember-rails.
Installation
Add this line to your application's Gemfile:
gem 'ember-middleman'
gem 'ember-source' # You can specify the version you want to use
Execute:
$ bundle
Or install it yourself as:
$ gem install ember-middleman
And insert the following line to your config.rb
:
activate :ember
Features
When you installed ember-middleman, the following features help you.
Path to libraries
You can use Ember.js and ember-data.
Please write the followings to your application.js
(or something you use):
You should require jQuery before require ember.
//= require ember
//= require ember-data
HTMLBars precompilation
You can use HTMLBars as your template language for Ember.js.
$ mkdir -p source/javascripts/templates
And put your template.
For example:
source/javascripts/templates/ok-button.js.hbs
It automatically set as Ember.TEMPLATES['ok-button']
.
Without precompilation, ember-template-compiler.js
is required for client side compilation.
Generator
You can generate a fresh project already setup for ember:
# Gemfile
source 'https://rubygems.org'
gem 'middleman'
gem 'ember-middleman'
$ bundle exec middleman init . --template=ember
Tests
bundle exec rake
Use Handlebars (using Ember.js < 1.10)
When you use Ember.js < 1.10, handlebars
is required in your application.js
.
//= require handlebars