pug

pug variable not evaluated on a href tag

可紊 提交于 2020-12-29 18:53:43
问题 In my Express JS web app, a login route renders some variables to the login pug view. In login.js router.get('/login', function(req, res, next) { var locations = ["Location 1", "Location 2"]; var count = 0; var title = 'Login'; console.log("req.originalUrl=" + req.originalUrl); res.render('login', { title: title, // Give a title to our page jsonData: locations, // Pass data to the View count: locations.length, originalUrl: req.originalUrl }); }); In login.pug extends layout block content div

How do I insert html tags in JS with pug?

感情迁移 提交于 2020-12-26 09:41:11
问题 When I need to use a JSON-like object in JS with different data in each block and iterating through that object I make a HTML code via pug. Let me describe it in code var footerMenu = { left: { title: "sometitle", list: [ { title: "First thing to do", text: "wake up and brush some teeth" }, { title: "Second thing to do", text: "start coding" }, (...) Problem comes when text withing property footerMenu.left[0].text has to be styled with some tags. I need something like this ...... text: "wake