Atul Arvind
Atul Arvind

Reputation: 16743

use boolean operator in jade conditions

I want to use a boolean operator in my jade template to activate the menu. for that my syntax is like

li(class={ active: "blogs" or "post" == type })
  a(href='blog.html')
    | Blog

I am using harpjs to compile jade in to html templates, when I compiles the template it gives me error like,

  "name": "SyntaxError",
  "message": "Unexpected identifier",

How to add boolean conditions correctly in jade?

Upvotes: 0

Views: 1115

Answers (1)

Atul Arvind
Atul Arvind

Reputation: 16743

I have resolved this issue with the help of Ben Fortune's Comment.

I replaced the or with || and the error was resolved.

the file code is looking like,

li(class={ active: "blogs" || "post" == type })
  a(href='blog.html')
    | Blog

Upvotes: 2

Related Questions