Skip to content

feature request: inline partial definitions #792

@ashanbrown

Description

@ashanbrown

There was some discussion on inline partial definitions and mustache/spec#63 but it looks like it went off the rails a bit.

I'm addicted to 'capture' in the erb/haml world. It seems to me that combined with subexpressions, you could use inline partial definition to pass the outputs of multiple blocks to a view or helper. Using one of the proposed partial definitions from @spudly, you'd be able to write code like this:

{{>> bold-name}}
  <strong>{{name}}</strong>
{{/>>}}
{{#tooltip title:(bold-name)}}
  My name is bold.
{{/tooltip}}

Maybe partials could even accept arguments. Sorry if I've got to wrong forum for this and if there is some better existing solution that I haven't stumbled across. I think that the general push on the mustache site discussion was to define such helpers outside the template. I didn't quite follow all the reasons given to oppose this idea, but given how convenient I find 'capture' in rails, I'd love for handlebars to offer the same convenience.

Thanks for your consideration. If there's interest in this, I might investigate a pull request for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions