Skip to main content

Questions tagged [pug]

Pug (formerly known as Jade) is a robust, elegant and feature-rich template engine for Node.js.

pug
129 votes
6 answers
134k views

How to pass variable from jade template file to a script file?

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....
Michael Eilers Smith's user avatar
152 votes
23 answers
475k views

Change the "No file chosen":

I have a button "Choose file" as follows (I am using Jade but it should be the same as Html5): input(type='file', name='videoFile') In the browser this shows a button with a text next to it "No ...
FranXh's user avatar
  • 4,671
14 votes
3 answers
33k views

Model.find().toArray() claiming to not have .toArray() method

I am very new to Node.js and MongoDB and am trying to piece together my own blogging application. I have a problem trying to query through my 'Blog' model for ones with a specific username. When I try ...
Rorschach120's user avatar
  • 1,210
70 votes
5 answers
67k views

Accessing Express.js local variables in client side JavaScript

Curious if I'm doing this right and if not how you guys would approach this. I have a Jade template that needs to render some data retrieved from a MongoDB database and I also need to have access to ...
braitsch's user avatar
  • 15.3k
52 votes
5 answers
36k views

Use a variable in a Jade include

I'm working with Jade and Express and I would like to use a variable in my include statement. For example: app.js app.get('/admin', function (req, res) { var Admin = require('./routes/admin/app')....
Spencer Carnage's user avatar
169 votes
9 answers
61k views

How can I get Express to output nicely formatted HTML?

When using Express for Node.js, I noticed that it outputs the HTML code without any newline characters or tabs. Though it may be more efficient to download, it's not very readable during development. ...
Stephen's user avatar
  • 8,130
259 votes
8 answers
267k views

How can I render inline JavaScript with Jade / Pug?

I'm trying to get JavaScript to render on my page using Jade (http://jade-lang.com/) My project is in NodeJS with Express, eveything is working correctly until I want to write some inline JavaScript ...
JMWhittaker's user avatar
  • 3,653
57 votes
7 answers
131k views

Loop in Jade (currently known as "Pug") template engine

I want to use a simple loop like for(int i=0; i<10; i++){}. How do I use it in the Jade engine? I'm working with Node.js and use the expressjs framework.
Huy Tran's user avatar
  • 4,391
84 votes
21 answers
235k views

Error: Failed to lookup view in Express

Note: my auto answer at end of the post I'm trying to make a better experience of nodeJS and i don't really like to get all the script in one file. so, following a post here i use this structure ./ ...
nax's user avatar
  • 1,224
31 votes
4 answers
21k views

Is there any way to use multiple view engines with Express + Node.js

Scenario: I had developed some transactional pages using Node.js, Express + Handlebars as view engine and MongoDB. Now the issue is during module integration I got some of the pages which are built ...
Amol M Kulkarni's user avatar
6 votes
2 answers
34k views

Multipart form data post method using express js

I tried to post form data to my express js server side. This is my pug file form(action="/profile" method="post" enctype="multipart/form-data") input(type="file" accept="image/*" name="profileimage")...
Lucas's user avatar
  • 85
43 votes
6 answers
55k views

socket.io - can't get it to work, having 404's on some kind of polling call

I'm trying to get a server set up with socket.io, with bad results. I am mostly following this guide, although it's somewhat out of date: http://www.williammora.com/2013/03/nodejs-tutorial-building-...
Eli's user avatar
  • 4,904
26 votes
3 answers
27k views

How to insert raw HTML in Pug file (not include external HTML file)

So what I want is to put some multiline HTML into a Pug file and can't find anywhere how to do this. Example: html head body <div><a href="lala"> blabla </a></...
ditoslav's user avatar
  • 4,802
66 votes
2 answers
43k views

Rendering HTML in variable using Jade

I have some text stored in a variable which contains some HTML. For example, the <b>cat</b> in the hat. However, when I render it in Jade, it shows up with the tags instead of rendering the ...
tofutim's user avatar
  • 23.1k
42 votes
1 answer
28k views

Passing objects to client in node + express + jade?

I have a pretty heavyweight query on the server that results in a new page render, and I'd like to pass along some of the results of the query to the client (as a javascript array of objects). This is ...
killermonkeys's user avatar

15 30 50 per page
1
2 3 4 5
31