如果它们是带有Handlebars的常规html,我会尝试将我的.jade模板分开。我试图保持原始的HTML结构。到目前为止,这一点很有效,直到我尝试将标题分成不同的文件。
./视图/布局/ main.jade
block header
include ../partials/layout-top.jade
|
block content
|
|
|<script src="/javascripts/plugins.js"></script>
|<script src="/javascripts/main.js"></script>
|
|</body>
|</html>
|
./视图/分音/布局top.jade :
block header
|<!doctype html>
|<html class="no-js" lang="">
|<head>
| <meta charset="utf-8">
| <meta http-equiv="x-ua-compatible" content="ie=edge">
| <title>My title</title>
| <meta name="description" content="#{description}">
| <meta name="keywords" content="#{keywords}">
| <meta name="author" content="info@domain.com">
| <meta name="generator" content="Static pages built on Node.js, Express.js, Markdown, Jade">
| <meta name="viewport" content="width=device-width, initial-scale=1">
| <link rel="apple-touch-icon" href="/apple-touch-icon.png">
| <link rel="shortcut icon" href="/favicon.ico" />
| <link rel="stylesheet" href="/stylesheets/style.css">
| <link rel="stylesheet" href="/stylesheets/style-helper.css">
|</head>
|<body class="#{bodyClass}">
./视图/ portfolio.jade :
extends ./layouts/main
block content
|<h1>#{title}</h1>
|<p>Welcome to #{title}</p>
./视图/ error.jade :
extends ./layouts/main
block content
|<h1>#{message}</h1>
|<h2>#{error.status}</h2>
|<pre>#{error.stack}</pre>
此解决方案不起作用。将呈现layout-top.jade文件,但不会显示#{description}
#{keywords}
之类的插值(仅""
之间的空格。)
有人可以告诉我,我做错了什么?