Saturday 22 April 2017

How to call a mixin in Jade that is being displayed in a Node/Express route

I'm trying to create a component that I'll be putting on a website many times using a Jade template.

My route looks like this:

router.get('/', function(req, res, next) {
    res.render('indicators',{category:"", number:"1", title:"whatever"});
});

indicators.jade:

extends layout

mixin indicator(category, number, title)
  div.dataEntryBlock
    div.number
        div.center.number #{number}
    div.dataEntryTitle #{title}


body
    block content
        +indicator(#{category}, #{number}, #{title})

But I get Unexpected token ILLEGAL on this line +indicator(#{category}, #{number}, #{title}) when I go to the route. Isn't this how I'm supposed to call a mixin?



via Glen Pierce

No comments:

Post a Comment