Nodejs / Swig如果扩展(Conditional Inheritance)

我正在寻找一种方式在Swig中,如果设置了一个variables,然后扩展布局。

{% set AjaxLoaded = "True" %} {% if AjaxLoaded %} im ajax {% else %} {% extends 'base.html' %} {% block Content %} im not ajax {% endblock %} {% endif %} 

由于某种原因,swig总是扩展base.html

我知道如果PHP /树枝他们有“有条件的inheritance”

  {% extends var ? "minimum.html" : "base.html" %} 

谢谢!

您不能在Swig模板中创build条件扩展或块。