2015-12-18 69 views
0

我有一些麻煩和玉表達。因此,這是serder側:javascript變成玉模板 - 服務器端

router.get('/login', function (req, res) { 
    res.status(200) 
    res.render('login',{title:'login'}) 
    res.end() 
}); 

這是我的玉:

doctype html 
html(lang='en') 
    head 

    meta(charset='UTF-8') 
    meta(name='viewport', content='width=device-width') 
    title= #{title} 
    block css 
     link(rel='stylesheet', href='/css/style.css') 
    block js 
     //script(src='../public/js/') 

     script(src='http://localhost:35729/livereload.js') 
    body 
    block content 

,當然,這些都是我的錯誤:

> 7|  title= #{title} 
    8|  block css 
    9|  link(rel='stylesheet', href='/css/style.css') 
    10|  block js 

Unexpected token ILLEGAL 
    at Function (native) 
    at assertExpression (/Users/VeaVictis/iGym/node_modules/jade/lib/lexer.js:30:3) 
    at Object.Lexer.code (/Users/VeaVictis/iGym/node_modules/jade/lib/lexer.js:584:23) 

和更大量後,但我不要認爲它們會有用。預先感謝大家。我藉此機會,祝你聖誕快樂

回答

2

嘗試刪除標題

之後等號(=)應該

title #{title} 
+0

是的!它的作品:)非常感謝你 – Francesco

+0

很高興我能幫忙! – Rastalamm