Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add new options explanation to README

  • Loading branch information...
commit d4f8831938ace4b2ac5e5af053e69bc187050f7c 1 parent 736a4d1
@tchak tchak authored
View
21 README.md
@@ -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:
View
4 lib/ember/handlebars/template.rb
@@ -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
View
4 lib/ember/rails/engine.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.