Skip to content

Mixin blocks from Pug or mixins are parameters #67

@fanmanpro

Description

@fanmanpro

I'm trying to achieve something using Amber that I regularly used in Pug. It would be best described as an example from the Pug documentation:

Mixins can also take a block of Pug to act as the content:

mixin article(title)
  .article
    .article-wrapper
      h1= title
      if block
        block
      else
        p No content provided

+article('Hello world')

+article('Hello world')
  p This is my
  p Amazing article

The resulting HTML:

<div class="article">
  <div class="article-wrapper">
    <h1>Hello world</h1>
    <p>No content provided</p>
  </div>
</div>
<div class="article">
  <div class="article-wrapper">
    <h1>Hello world</h1>
    <p>This is my</p>
    <p>Amazing article</p>
  </div>
</div>

I tried the same code with Amber but it just ignores it.

I also tried sending mixins as parameters of a mixin. This also doesn't seem possible:

 +header("Header Text")        
 +twocolumns(+header, +header) 

Any workaround for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions