3

ミックスインの下

mixin form(title, action)
    legend title
    form.form-horizontal(method='post', action=action)
        label Name:
        input(type='text',name=Name,id=Name)

にレンダリングします

<legend>title</legend>
<form method="post" action="save" class="form-horizontal">
  <label>Name:</label>
  <input type="text"/>
</form>

ここで、ラベルとフィールドを別の mixin に抽出しました

mixin form(title, action)
    legend title
    form.form-horizontal(method='post', action=action)

mixin field(name)
    label #{name}:
    input(type='text',name=name,id=name)

として使用します

mixin form("xxxx", "save")
    mixin field('Name')

これによりエラーが発生します

>> Line 1209: Unexpected string
Warning: Jade failed to compile test.jade. Use --force to continue.

ミックスインをネストすることは可能ですか、それを最初の出力としてレンダリングする方法。

ありがとう

4

2 に答える 2