News for hackers. Stuff that matters.
Re:Rethinking Backbone.js View Rendering by jscheel on Friday March 08, 2013 @10:26AM (#5343893)
I absolutely love Backbone, but the biggest issue for me has been dealing with complex logic in the templates. Most of the time now my render() method just builds the darn elements right in there.
Re:Rethinking Backbone.js View Rendering by hippich on Friday March 08, 2013 @10:53AM (#5344043)
as long as it is just a view and not data manipulation, what is wrong with that? You do not have to have template at all. What if your view is list generator with classes? Why having template at all?
Re:Rethinking Backbone.js View Rendering by jscheel on Friday March 08, 2013 @11:00AM (#5344087)
It can get pretty messy at times.
Re:Rethinking Backbone.js View Rendering by georgedyer on Friday March 08, 2013 @11:24AM (#5344202)
Re:Rethinking Backbone.js View Rendering by account_taken on Friday March 08, 2013 @11:59AM (#5344430)
Try https://github.com/mgutz/funcd. It's straight up CoffeeScript functions patterned after Markaby, Erector. Other CoffeeScript templates we tried did funky things with the context and closures didn't work as expected.

And when performance is a concern, you can't beat string interpolation within CoffeeScript heredoc strings.

Re:Rethinking Backbone.js View Rendering by jscheel on Friday March 08, 2013 @02:01PM (#5345061)
Yep, that's usually how I start my render() method (using triple-quote strings). Then I wrap it in jquery and do dom manipulation on it.
Re:Rethinking Backbone.js View Rendering by jeffmess on Friday March 08, 2013 @04:43PM (#5345912)
Why can't people just use regular HTML for markup? Coffeescript is beautiful when you are composing short succinct functions but this just looks like more work for my brain.
Re:Rethinking Backbone.js View Rendering by jscheel on Friday March 08, 2013 @11:31AM (#5344245)
I used coffeekup back in the day, but I just can't stand the jade-style declarative html. I also used eco for a while, but it got pretty messy too. I'm picky, I know :)