amber icon indicating copy to clipboard operation
amber copied to clipboard

Mixin blocks from Pug or mixins are parameters

Open fanmanpro opened this issue 7 years ago • 0 comments

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?

fanmanpro avatar May 04 '18 16:05 fanmanpro