pug Questions
2
I have this code in my controller retrieving an object from mongo and sending it to the client:
index: function(req, res){
List.find({user:req.session.user.id}).exec(function foundLists(error, f...
3
Solved
How do I require a library so that it works inside Jade.
Like if I want to be able to use CircularJSON in Jade
script var object = #{CircularJSON.stringify(object)}
I would basically need to d...
5
Solved
I have an index.js:
exports.index = function(req, res){
db.courses.find(function(err, currentCourses) {
res.render('index', {
currentCourses: currentCourses
});
});
};
And on my jade templa...
13
How to I get rid of Jade while using Express with Node.JS? I want to just use plain html. In other articles I have seen that people recommended app.register() which is now deprecated in the latest ...
4
Solved
- if (typeof(person) == 'undefined')
input(type="text", name="person[Name]")
- else
input(type="text", name="person[Name]", value="#{person.Name}")
Is there any way to write this inline? I ha...
Koheleth asked 19/12, 2011 at 16:10
3
Solved
So for my Express site, I'm using jade. So I decided to try modifying my layout file so I can start designing my site. I modified the original layout code (which worked), but I started getting inde...
Catherincatherina asked 20/8, 2013 at 19:39
6
Solved
I have a Pug template that uses Bootstrap 4 as the 'layout' and receiving data from an Express/Mongoose server.
I am populating a form from MongoDB so the contents can be edited. I have been looki...
Wrathful asked 12/10, 2016 at 11:34
1
Solved
I know we are able to use ternary for attr but I am wondering if we can do it with plain text?
let's say I have something like this
button.btn.btn-round.btn-info
|
if image
| Change Image
el...
Bagnio asked 24/9, 2018 at 22:59
1
Only named blocks and mixins can appear at the top level of an extending template. Its killing me and i cant understand why this is not working. Im new to pug and maybe i should be using something ...
2
there are all kinds of posts about this, but I'm still not getting it.
I want to upload a *.csv and read and process its contents.
my jade file is this
//views/import.jade
extends layout
block ...
Downcome asked 17/8, 2014 at 0:25
6
Solved
I'm having trouble with a variable (config) declared in a jade template file (index.jade) that isn't passed to a javascript file, which then makes my javascript crash. Here is the file (views/index...
Tuscarora asked 2/1, 2012 at 7:46
2
Solved
So I am using NodeJs (with pug as its view engine). My intention is to create a table where an each loop on my pug code adds the data from the data.json file in rows on a table.
First let me show ...
Politician asked 29/8, 2018 at 7:21
8
Solved
Jade is indeed very neat, but I personally dislike the syntax and look of it. Yeah, being able to write just :
body
h1 Hello
p This is
b bold
Thats cool and all, but I prefer the look and fe...
Indult asked 11/9, 2011 at 1:37
2
Solved
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"];
v...
Dunbarton asked 16/8, 2018 at 3:17
1
I am using Pug template engine with Node + Express app.
I need some calculation in the Pug file. For example, I have an array of object and I have to print the sum of all object's amount field and...
Warrick asked 4/8, 2018 at 11:59
1
I have the below form written in JADE
<form id="formAddchallandetails" action="/adddata" method="post" name="adduser">
<input id="inputunloadingDestination1" type="text" name="finalchal...
2
Solved
I'm trying to add a dynamic class to a jade template. Like so:
- var obj = {a: 1, b: 2, c: 3};
- var len = Object.keys(obj).length;
.abc-#{len}
But the compiler is taking exception to this:
&...
Cristincristina asked 16/12, 2016 at 18:15
2
Is it possible to use it? For example here:
- var movieList = [{title: "Ocean's Eleven", rating: 9.2}, {title: "Pirates of the Caribbean", rating: 9.7}];
mixin movie-card(movie)
h2.movie-title= ...
1
Solved
I have a file includes/mixins.pug that has some mixins. I also have a main layout file layouts/default.pug that I am extend-ing. How can I include those mixins in my layout file so that I don't hav...
Nigeria asked 18/5, 2018 at 22:33
2
For some reason I can't pass a variable to the pug template with Node JS.
app.get("/", function (req, res) {
res.render('index', { hello : 'Hey'} )
})
....
extends layout.pug
block content
h...
1
Solved
Is it possible to pass in parameter for includeed pug files inside the parent pug file. For example if I have a child template example.pug:
p #{name}'s Pug source code!
And a parent parent.pug
...
Endorsee asked 17/4, 2018 at 17:53
3
Solved
There is some way to make strong some words in the same code line using Jade to generate the HTML?
I try to use markdown code, like this. But isn't working:
p Here are my **strong words** in my s...
5
Solved
I have a layout Jade view that has a menu via unordered list, and I want to set the <li> to be <li class="active">...</li> when the current page is rendered in the browser.
I ass...
0
Using Pug filters and the jsTransformer-handlebars module I'm trying to insert some handlebars code into a pug template that will make use of locals. However, since Pug renders filters at compile t...
Bassist asked 25/3, 2018 at 3:26
2
i have read some of pug documentation. its said that i have to install pug first and i'm already done that. then i have to require pug in my js file.
but i don't know where to write the compile for...
Quipu asked 18/6, 2016 at 9:53
© 2022 - 2024 — McMap. All rights reserved.