Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 将页脚添加到my Jade模板时超出了最大调用堆栈大小_Node.js_Express_Pug - Fatal编程技术网

Node.js 将页脚添加到my Jade模板时超出了最大调用堆栈大小

Node.js 将页脚添加到my Jade模板时超出了最大调用堆栈大小,node.js,express,pug,Node.js,Express,Pug,好吧,这有点奇怪,但情况是这样的 我在玩Express和Jade诱惑系统 我有一个相当简单的布局。jade文件: doctype 5 html head title= title link(rel='stylesheet', href='/stylesheets/style.css') h1 Nav goes here! body block content extends layout block foot h1= me 和一个home.jad

好吧,这有点奇怪,但情况是这样的

我在玩Express和Jade诱惑系统

我有一个相当简单的
布局。jade
文件:

doctype 5
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
    h1 Nav goes here!
  body
    block content
extends layout

block foot
  h1= me
和一个
home.jade
文件:

doctype 5
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
    h1 Nav goes here!
  body
    block content
extends layout

block foot
  h1= me
扩展布局

block content
  h1= title
  p Welcome to #{title}
上述组合效果良好

但是,我想添加一个页脚,所以我创建了一个
foot.jade
文件:

doctype 5
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
    h1 Nav goes here!
  body
    block content
extends layout

block foot
  h1= me
并将
include foot
添加到我的
layout.jade
文件中

现在,如果我尝试访问我的应用程序主页,我会收到一个
超过最大调用堆栈大小的错误:/

我的app.js文件是:

/**
 * Module dependencies.
 */

var express = require('express')
  , home = require('./routes/home')
  , http = require('http')
  , path = require('path');

var app = express();

app.configure(function(){
  app.set('port', process.env.PORT || 3000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.cookieParser('your secret here'));
  app.use(express.session());
  app.use(app.router);
  app.use(require('stylus').middleware(__dirname + '/public'));
  app.use(express.static(path.join(__dirname, 'public')));
});

app.configure('development', function(){
  app.use(express.errorHandler());
});

app.get('/', function(req, res) {
  res.render('home', {title: 'Ninja Store'});
});

http.createServer(app).listen(app.get('port'), function(){
  console.log("Express server listening on port " + app.get('port'));
});

foot.jade
使用
extends layout
,加载
layout.jade
,其中包含
foot.jade
,使用
extends layout
,加载
layout.jade


换句话说:从
foot.jade
;)中删除
extensedlayout

或者在index.jade中添加
block foot
,并删除
include foot
@generalhenry如果
include foot
更改为
block foot
,那么如何调用
foot
部分进行渲染?