抱歉,出了点问题。可能我们的“天才”程序员之一做了一个嘘声! :P
SyntaxError: /home/fzxa/work/blog2/views/articles/index.jade:7
5| div#articles
6| - if(articles.length)
> 7| !=partial('article_list', {collection : articles, as : 'article'})
8| - else
9| #no-results No articles found. Create one
10| a(href="/articles/new") here
Unexpected reserved word
at Object.Function (unknown source)
at Object.compile (/home/fzxa/work/blog2/node_modules/jade/lib/jade.js:161:8)
at Function.compile (/home/fzxa/work/blog2/node_modules/express/lib/view.js:65:33)
at ServerResponse._render (/home/fzxa/work/blog2/node_modules/express/lib/view.js:414:18)
at ServerResponse.render (/home/fzxa/work/blog2/node_modules/express/lib/view.js:315:17)
at render (/home/fzxa/work/blog2/node_modules/express/lib/view.js:184:16)
at renderPartial (/home/fzxa/work/blog2/node_modules/express/lib/view.js:204:16)
at Object.partial (/home/fzxa/work/blog2/node_modules/express/lib/view.js:409:12)
at eval at (/home/fzxa/work/blog2/node_modules/jade/lib/jade.js:161:8)
at Object. (/home/fzxa/work/blog2/node_modules/jade/lib/jade.js:166:12)
答案 0 :(得分:0)
问题出在article_list局部视图中。代码使用保留的“class”一词。在article_list.jade中更改
- if(lastInCollection)
- class = 'last'
- else
- class = ''
div(class="article #{class}")
到
- if(lastInCollection)
- cls = 'last'
- else
- cls = ''
div(class="article #{cls}")