无法在Vash中加载模板

时间:2015-11-21 00:46:01

标签: express vash

我使用Vash作为我的模板引擎。我想在一个单独的文件中包含页眉和页脚,我想包含在layout.vash

layout.vash

Color

header.vash

<body>
    <header>
        @html.block('header')
    </header>
    @html.block('content')
    <footer>
        @html.block('footer')
    </footer>
     <!-- Render Page Specific Scripts Here -->
    @html.block("scripts")
</body>

index.vash

@html.block('header', function(){
<!--==============================header=================================-->
<div class="container_12">
    <div class="grid_12">
        <h1>
                <a href="index.html">
                    <img src="images/logo.png" alt="Your Happy Family">
                </a>
            </h1>
    </div>
</div>
})

页眉和页脚模板未插入。有任何想法吗?

1 个答案:

答案 0 :(得分:1)

Layout.vash:

<body>
<header>
    @html.include('partials/header')
</header>
@html.block('content')
<footer>
    @html.include('partials/footer')
</footer>
 <!-- Render Page Specific Scripts Here -->
@html.block("scripts")

header.vash:

<div class="container_12">
    <div class="grid_12">
        <h1>
            <a href="index.html">
                <img src="images/logo.png" alt="Your Happy Family">
            </a>
        </h1>
    </div>
</div>

footer.vash:

<p>Your footer html</p>

请注意,partials文件夹应位于views文件夹中。