Francesco
Francesco

Reputation: 531

javascript variable into jade template - server side

i'm having some troubles with jade and express. So this is the serder side:

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

This is my jade:

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

And, of course, these are my errors:

  > 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)

and a lot more after but i don't think that they will be usefull. Thank you in advance to everyone. I take this opportunity to wish you a merry xMas

Upvotes: 0

Views: 108

Answers (1)

Rastalamm
Rastalamm

Reputation: 1792

Try removing the = sign after title

It should be

title #{title}

Upvotes: 2

Related Questions