I've been reading over the moustache documentation, and it looks cool: https://github.com/defunkt/mustache
There is a clear separation between ruby code and html markup. Having not started a moustache project, my confusion is this: how should ruby that generates markup be handled? Obvious examples would be form helpers and link_to, not to mention any custom methods. Would it be proper (or possible) to do {{link_to ...}}? -- having code in the markup. Or to define a custom method in the view ruby: {{whatever_link}}? -- this seems non-DRY and equally undesirable. Where's the win?
Thanks!
--Peter
Mustache is very simple by design. Templates are supposed to be renderable in many languages (see https://github.com/defunkt/mustache/wiki/Other-Mustache-implementations). Many web applications chose mustache because templates can be shared by client code (javascript) and server code (whatever language).
The win is not to go against that fact, even if it may look inconvenient at first sight.
Investigate the {{whatever_link}} solution, and keep your code as DRY as you can.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With