Questions tagged [pug]
Pug (formerly known as Jade) is a robust, elegant and feature-rich template engine for Node.js.
6,473
questions
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 ...
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.
...
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 ...
146
votes
9
answers
51k
views
Syntax highlighting for Jade in Sublime Text 2?
I just started using Sublime Text 2 on Mac. I also just started using Jade for my views in Node.js, and am wondering if there is a way to add syntax highlighting for Jade into Sublime Text 2.
130
votes
13
answers
78k
views
Jade: Links inside a paragraph
I'm trying to author a few paragraphs with Jade, but finding it difficult when there are links inside a paragraph.
The best I can come up with, and I'm wondering if there's a way to do it with less ...
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....
122
votes
2
answers
85k
views
What are the pros and cons of both Jade and EJS for Node.js templating? [closed]
Jade versus EJS, what are the pros and cons of each and what purposes are each designed for?
Are there any other express-compatible template engines that are good and why?
122
votes
10
answers
48k
views
What's the use of Jade or Handlebars when writing AngularJs apps
I am new(ish) to the whole javascript full stack applications, and completely new to Angular, so I was hoping somebody can put the record straight for me here.
Why would I need to use a templating ...
108
votes
13
answers
89k
views
Using HTML in Express instead of Jade
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 ...
102
votes
11
answers
373k
views
Node - how to run app.js?
I am very new to Node.js and I tried to run a project (made by other developer) by having a command in terminal node app.js. But I encountered below error, do you have any idea how to run this project?...
84
votes
7
answers
74k
views
Jade - Template Engine: How to check if a variable exists
I'm currently using Jade on a new project. I want to render a page and check if a certain variable is available.
app.js:
app.get('/register', function(req, res){
res.render('register', {
...
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
./
...
82
votes
6
answers
56k
views
Jade conditional (if/else) to add class to div inline
Is there a way to do this inline in a jade template?
if(typeof fromEdit != 'undefined')
div#demo.collapse.in
else
div#demo.collapse
Would like to do this conditional check "inline" and the ...
80
votes
2
answers
48k
views
Comments in Jade/pug
I tried making comments in Jade/pug, but the comments render as text in the HTML. This is my code:
doctype html
html(lang='en')
body
/ This should be a comment
What am I doing something ...
77
votes
4
answers
97k
views
How to use the style tag with jade templates?
This style code worked for me a few months back. I have updated to the latest Jade NPM package and now it is not working. Can some please assist me with the proper way to inline a style in a Jade ...