1

我发现很难弄清楚 MEAN.IO 堆栈如何定义在整个模块和/或包中使用的 default.html 模板。我正在尝试将一种视图更改为使用 default.html 模板,以使用我定义的一种。

他们的文档http://mean.io/#!/docs说他们使用 'swig' 作为他们的模板系统。但是,我进行了文件搜索,在模板中,我发现 5 次出现“swig”,它只在 html 中声明为文本。我没有看到在哪里使用 swig,也没有在后端注入。它应该在后端。有任何想法吗?.

默认是我所有其他页面用作其父级的 html 模板。我想将该 html 更改为另一个。这是 default.html 的样子:

<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="https://www.facebook.com/2008/fbml" itemscope="itemscope" itemtype="http://schema.org/Product">
{% include '../includes/head.html' %}

<body>
    <div class="navbar navbar-default navbar-fixed-top" data-ng-include="'/system/views/header.html'" data-role="navigation"></div>
    {% if adminEnabled %}
    <section class="admin-menu">
        <div data-ng-include="'/mean-admin/views/index.html'"></div>
    </section>
    {% endif %}
    <section class="content">
        <section class="container">
            {% block content %}{% endblock %}
        </section>
    </section>
    {% include '../includes/foot.html' %}
</body>

</html>
4

1 回答 1

2

万一其他人在这里找到答案希望得到答案:文档可以在这里找到: http ://learn.mean.io/#mean-stack-packages-overriding-the-default-layouts

从文档中:

可以通过自定义包覆盖应用程序的默认布局。下面是一个覆盖系统默认布局的示例,而是使用包中本地找到的布局

MyPackage.register(function(system, app) {
  app.set('views', __dirname + '/server/views');
  // ...

请注意,包必须依赖于 System 以确保在 System 之后对其进行评估,因此可以覆盖 views 文件夹

于 2015-01-11T03:48:43.513 回答