mercredi 18 février 2015

How to add css link to .jade file

I am creating a nodejs application and i use the jade engine view


I am using bootstrap so in jade i import it in the following way:



html
head
title=title
link(href('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css', rel='stylesheet'))
body
div.container
div.jumbotron
h1 Hello!

if user
p Welcome, #{user.fullName}
p
a.small(href="profile") Edit my profile
a.btn.btn-primary(href="/logout") Logout
else
p Welcome to my app, ready to get started?
p
a.btn.btn-primary(href="/login") Login now
p
span.small Don't have an account=
span  
a.small(href="/register") Register now


Although when i run this. I get the following error:



SyntaxError: C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\views\home.jade:4
2| head
3| title=title
> 4| link(href('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css', rel='stylesheet'))

Unexpected token )
at Function (<anonymous>)
at assertExpression (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\lexer.js:30:3)
at Object.Lexer.attrs (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\lexer.js:661:20)
at Object.Lexer.next (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\lexer.js:922:15)
at Object.Lexer.lookahead (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\lexer.js:113:46)
at Parser.lookahead (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\parser.js:102:23)
at Parser.peek (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\parser.js:79:17)
at Parser.tag (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\parser.js:752:22)
at Parser.parseTag (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\parser.js:738:17)
at Parser.parseExpr (C:\Users\user\Documents\SIGMA\NodeDotJS\real_examples\login-page\node_modules\jade\lib\parser.js:211:21)


What is wrong with this jade code? i open ( and i close it.


Aucun commentaire:

Enregistrer un commentaire