Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handlebars templates in HAML using Ember.js

Tags:

ember.js

haml

I'm looking for a way to write my Handlebars templates using HAML, in a Ember.js application embedded in a Rails 3.2 project.

Handlebars is 1.0.rc.1, require'd from ember-rails gem 0.7.0
Ember is 1.0.pre-90-g60e3c05

Anyway, my template now looks like that :

<div id="container">
  This is my test
</div>

I'd like it to be like this :

#container
  This is my test

BTW, I'v seen James Harton's Hamlbars but I could not figure out how to make it work. It kept outputing Ember.TEMPLATES["templates/choose_resort"] = Ember.Handlebars.compile("This is my test"); instead of the intended :

<div id="container">
  This is my test
</div>

(even the div block is missing in the what-seems-to-be-uncompiled-code returned)

Any hint would be greatly appreciated. Thanks in advance.

like image 488
Michael Baudino Avatar asked Sep 13 '12 20:09

Michael Baudino


People also ask

What is handlebars template in Ember?

Ember uses the Handlebars templating library to power your app's user interface. Handlebars templates contain static HTML and dynamic content inside Handlebars expressions, which are invoked with double curly braces: {{}} . Dynamic content inside a Handlebars expression is rendered with data-binding.

What is handlebars template?

Handlebars is a simple templating language. It uses a template and an input object to generate HTML or other text formats. Handlebars templates look like regular text with embedded Handlebars expressions.


1 Answers

Try the new Emblem.js. It's closer to Slim than HAML but cleanest you'll get if you're fond of indented templating languages and Ember.js.

And it is the one recommended by Ember.js guide

like image 159
Alexander Wallace Matchneer Avatar answered Oct 02 '22 10:10

Alexander Wallace Matchneer