Permalink
Browse files

add new options explanation to README

  • Loading branch information...
1 parent 736a4d1 commit d4f8831938ace4b2ac5e5af053e69bc187050f7c @tchak tchak committed Apr 9, 2012
Showing with 25 additions and 4 deletions.
  1. +21 −0 README.md
  2. +2 −2 lib/ember/handlebars/template.rb
  3. +2 −2 lib/ember/rails/engine.rb
View
@@ -66,6 +66,27 @@ and including the assets in your layout:
<%= javascript_include_tag "templates/admin_panel" %>
+If you want to strip template root from template names, add `templates_root` option to your application configuration block :
+
+ config.handlebars.templates_root = 'templates'
+
+The result will be like this :
+
+ Ember.TEMPLATES['admin_panel'] = "...";
+
+If you want a different path separator in template names add `templates_path_separator` option to your application configuration block :
+
+ config.handlebars.templates_path_separator = '-'
+
+The result will be like this :
+
+ Ember.TEMPLATES['templates-admin_panel'] = "...";
+
+Default behavior for ember-rails is to precompile handlebars templates only in production environment.
+If you don't want this behavior you can turn it off in your application configuration block :
+
+ config.handlebars.precompile = false
+
Bundle all templates together thanks to Sprockets,
e.g create `app/assets/javascripts/templates/all.js` with:
@@ -32,11 +32,11 @@ def mustache_to_handlebars(scope, template)
def template_path(path)
path = path.split('/')
- root = configuration.template_root
+ root = configuration.templates_root
path.delete(root) unless root.blank?
- path.join(configuration.template_path_separator)
+ path.join(configuration.templates_path_separator)
end
def configuration
@@ -5,8 +5,8 @@ module Rails
class Engine < ::Rails::Engine
config.handlebars = ActiveSupport::OrderedOptions.new
config.handlebars.precompile = ::Rails.env.production?
- config.handlebars.template_root = nil
- config.handlebars.template_path_separator = '/'
+ config.handlebars.templates_root = nil
+ config.handlebars.templates_path_separator = '/'
initializer :setup_ember_rails, :group => :all do |app|
app.assets.register_engine '.handlebars', Ember::Handlebars::Template

0 comments on commit d4f8831

Please sign in to comment.