これは短くしておきます。Expressjsを使用してjadeテンプレートをレンダリングしようとしています。Express3.0.0rc5とjade0.27.6を使用しています。
これが私の翡翠のテンプレート、レイアウトです:
// test-layout.jade
doctype 5
html
head
title My title
block head
body
#content
block content
そしてインデックス:
// test-index.jade
extends test-layout
block head
script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js")
block content
h1 My page
app.jsからの抜粋を次に示します。
var app = express();
// Configuration
app.configure(function(){
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
app.get('/test-jade', function(req, res) {
res.render('test-index', {}, function(err, html) {
});
});
app.get('/test', function(req, res) {
res.send('this works');
});
これで、 http://myurl.com/test-jadeにアクセスしようとすると、ブラウザがハングし、コンソールに出力が表示されずにタイムアウトします(開発モードになっている場合でも)。
ただし、http://myurl.com/testにアクセスすると、「これは機能します」と表示されます。
ここでは本当に単純なものが欠けているように感じます。現在、2.5から3.0にアップグレードしています。
誰かアドバイスがあれば事前に感謝します。