The :javascript filter is really only useful for writing inline javascript very quickly, but not much else in my experience. Certainly not very helpful for Backbone templates, since the type attribute needs to be something other than text/javascript, and you need to stick an ID onto the emitted script tag.
Instead, what I have done is just emit the tag and use Haml to structure the Backbone templates, business-as-usual. %script#template-name{ :type => "text/template" } %ol.comments <% _.each(comments, function(c) { %> %li <%= c.title %> <% }); %> Just make sure not to nest the LI tag within your _.each method. As far as Haml is concerned, it should be on the same level of indentation. If it's not, Haml will throw indentation errors. Just FYI, this is not the way Haml is intended to be used, and it's a bit rough to use it this way. That said, I still prefer Haml over HTML for Backbone templates. -- Lorin Tackett Browser Wrangler http://lorintackett.com • lorin.tack...@gmail.com • 206.395.5242 On Thursday, February 16, 2012 at 2:23 AM, haml_newbie wrote: > I tried use filter :javascript, but how set type and id atributes for script > tag? > > -- > You received this message because you are subscribed to the Google Groups > "Haml" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/haml/-/EfS9vHJYMqUJ. > To post to this group, send email to haml@googlegroups.com > (mailto:haml@googlegroups.com). > To unsubscribe from this group, send email to > haml+unsubscr...@googlegroups.com (mailto:haml+unsubscr...@googlegroups.com). > For more options, visit this group at > http://groups.google.com/group/haml?hl=en. -- You received this message because you are subscribed to the Google Groups "Haml" group. To post to this group, send email to haml@googlegroups.com. To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/haml?hl=en.