Express.js で Mustache パーシャルを読み込もうとしていますが、明らかに少し問題があります。ビューの部分ファイルが含まれている場合、次のような EJS アプローチを取ることは可能ですか?
index.htmlというテンプレート ファイルがあります。
<html>
<head>
<title>My Title</title>
</head>
<body>
{{>header}}
</body>
</html>
およびheader.mustache
<div class="header">
<div style="display: table-cell;padding-left: 10px;padding-top: 8px;vertical-align: middle;">
<img src="images/logo.png">
</div>
</div>
Express.js では、レンダリング関数は次のようになります。
app.get('/', function(req, res) {
res.render('signup.html', {
partials: {
header: partial('header.mustache') //this line is wrong
}
});
});
私は初心者ですが、どうにかして header.mustache の内容全体をヘッダー オブジェクトにレンダリングまたは読み取りたいと考えています。これは可能ですか?