Questions tagged [pug]
Pug (formerly known as Jade) is a robust, elegant and feature-rich template engine for Node.js.
6,372
questions
0
votes
0
answers
18
views
Invalid value with express validator using html and pug
I am new at pug and nodejs.
I am trying to create a validation form before i can send to the next page, but i am struggling with it. I have already succeed with form validation using html, but when i'...
0
votes
0
answers
7
views
What is the equivalent command of "express-generator --view=pug my_app" for "express-generator-typescript"?
In JavaScript version of NodeJS there is a command as express-generator --view=pug my_app, but what about express-generator-typescript?
Does --view=pug also works with TypeScript version of NodeJS or ...
0
votes
0
answers
21
views
How to create component in Vue3 using TypeScript, Pug Template engine and Composition API
When I am exporting components inside <script setup lang="ts"> and using in <template lang="pug">, it's throwing error, defined but never used.
For example:
<...
0
votes
0
answers
13
views
Parcel + Pug - Multiple pages causes build to break
I am using parcel + pug for a project and everything was working great until I tried to add another page. It seems like it causes the bundler to fail.
Cannot find module '../node_modules/parcel-...
-1
votes
1
answer
14
views
PUG: How to make a button that links to another page, it is not working [duplicate]
This is my code. I normally can do this in HTML but I am learning PUG. I don't know why the link is not working. I can't make it go to another HTML page. I don't understand why it is not working.
...
0
votes
3
answers
29
views
node js mysql query result rendered to chart.js labels in pug page
I've this strange behaviour when i make a get request. A query to mysql calls for totals of sells(float) group by days (nvarchar). I've made 2 arrays (for totals and datas) where i push the content of ...
1
vote
2
answers
72
views
How do I iterate through an inline var using pug
I am attempting to iterate through an array and each time add 1 to the inline pug variable. So far this is what I got.
ul(class="benchcards")
- var i = -1
each card ...
1
vote
1
answer
16
views
I can't call PATCH method using Pug, Mongoose and Express.js
I am new to code and I apologize in advance for all my noob mistakes.
I'm trying to set a new color to an existing object stored in MongoDB using the PATCH method in the browser, but I don't ...
0
votes
0
answers
15
views
I'm trying to create a search bar that searches through my fields for MySQL table
I'm new to web development and have decided to create a Progressive Web Application for a library using PUG, JavaScript(vanilla I think) and PhpMyAdmin. (You can browse its book collection, read a ...
0
votes
0
answers
15
views
Socket.Io how can show the file with socket io uploader?
I'm trying to upload the file using socket io uploader and show it to the client, but I can't see the image.
Uploading the file is successful, but the uploaded file is not visible to the img tag ...
3
votes
1
answer
69
views
How to make ESLint understand that function is used in vue pug template?
I have following vue component.
<template lang="pug">
button(@click="onLogout") Logout
</template>
<script setup lang="ts">
function onLogout() {
// ...
0
votes
1
answer
33
views
Randomly Populate table rows in Pug files
Until this morning, I did not know what Pug is. However, now, it's being used in a theme that I am using for work. Ran into this situation.
The current pug file looks like this.
table#datatablesSimple
...
0
votes
0
answers
40
views
Why The Content Is Repeating 6 Times Even After Making A For Loop For 3 Times
This Is The Code Which Of Node JS Of A RouteCheck The Result
text.find().then((result)=>{
// let posts = {Uname: result[randomness].username, Tpost: result[randomness].postText, Likes: ...
0
votes
1
answer
27
views
Using express to serve public static files
I'm trying to get my express to serve files from my public folder but I can't seem to get anything to work here. I have tried so many variations in my file paths yet I can't seem to get pug to ...
0
votes
1
answer
43
views
I am having a problem to convert the following Ejs to pug
I am having a problem to convert the following Ejs to pug
in admin/edit-product.ejs
we can make changes with product already we have it
but But I want to transfer ejs to pug
any solutions
<form ...
0
votes
1
answer
15
views
Accessing data from ORM in pug
I have a question, when I pass an Instance to the Pug file I just access the object passed as
each row in headings
tr
td= row.id
while the objects is wrapped under an object itself, so how I am ...
0
votes
1
answer
47
views
CORS Error when including scripts in Node JS Pug Template
I have an express server which uses the PUG as a template engine. I am trying to add tailwind CSS using the cdn but I'm getting a cors error like this:
Error: Access to script at 'https://cdn....
0
votes
2
answers
22
views
How to add the value passed in the view to a href attribute in a pug view
Here is the function passing the data to the view
I don't understand what i am doing wrong that i receive an error at this line when the view is loaded
a(href="https://imdb.com/title/"+${m....
0
votes
1
answer
17
views
How to enable Javascript in Jade template to access DOM?
I want to draw on a HTML5 canvas in a Jade template. To do this, I need to use some Javascript like this:
function tileAllCanvases(){
var c = document.getElementById("canvas");
...
0
votes
2
answers
38
views
How to add a line break in pug?
I want the definition to be below the search bar. Now it's next to the search button. How can I add a line break in pug?
My code:
h1 Type any word here...
input(type='text' id="search" ...
0
votes
1
answer
30
views
passing dynamic url into html/pug
I have social buttons for sharing the current page on all my web application pages, the URL attribute is as follows data-url="https://www.myPage.com/whateverComes". However, I am looking for ...
2
votes
2
answers
31
views
How to add a GIF into Pug template?
I was trying to display a gif from Giphy to the webpage through pug. Here is my code:
gif(src='https://giphy.com/embed/u458Fo50SS1K3kqVyK') It's not working. Anyone knows what the pug syntax should be?...
0
votes
1
answer
14
views
i am not able to render images with pug view template
doctype html
html(lang="en")
head
meta(charset="UTF-8")
meta(http-equiv="X-UA-Compatible", content="IE=edge")
meta(name="viewport", content="...
0
votes
1
answer
34
views
How can I pass param to another file in pug?
I have a layout.pug file that setup a layout for all page in my project.
doctype html
html(lang='en')
include head.pug
body(class='')
include header.pug
block content
...
0
votes
0
answers
19
views
Csurf (Cross Site Request Forgery) Protection in a pop up css login authentication modal in Pug/Express
I can't seem to get my csurf token to work in my pop up strictly css modal, for authentication purposes. It works fine in a page (not in modal). I am using Pug view engine, express and cookie parser. ...
0
votes
0
answers
23
views
How to send multiple checkbox values to database from pug with typescript
so I have a registration form with checkboxes list. If user checks multiple boxes then I need that values go like this to database:
USER_ID | 1st CHECKBOX_VALUE | CHECKED OR NOT.
SAME USER ID | 2nd ...
1
vote
1
answer
51
views
album art not showing, using express.js, node.js, pug, javascript
I am trying to create a music app that can serve music files to an audio element. Eventually I want a client side ui that can pick a song from a playlist and even offer a possibility of creating your ...
0
votes
0
answers
18
views
I am using Pug for my node.js app, how can I print the data of two Web API arrays into one for each loop?
This is my code:
table.w3-table-all.w3-centered
tr
th Name
th Symbol
th Coin
th Test
each coin in data.data
...
0
votes
1
answer
29
views
How can I call an API different endpoints by calling my loadApi function every time I need to add a new end point? I'm using axios for my request
I'm working with an API and I'd like to know how to send a request to multiple end points by calling my "Load Api " function every time I need to work with a different end point.
Here's my ...
0
votes
1
answer
37
views
How can I properly use moment inside of pug?
I'm trying to use moment to format a date in PUG.
This is my code:
table(style='width:50%', border='2')
tr
th Event Title
th Date
th Coin
th Name
th ...
0
votes
1
answer
24
views
Placing tags on both sides of HTML content with Pug
I'm a beginner web developer who is using Pug for a Node JS school assignment. I've been struggling trying to figure out how to place two tags on both sides of the content of their parent tag.
For ...
1
vote
1
answer
32
views
Express using Pug: GET http://localhost:3004/contact 404 (Not Found)
I am creating an app using Express.js and Pug as a view engine. It has a navigation bar redirecting the user to the 3 possible pages: Homepage, Contact, and Our Services.
The issue here is that only ...
0
votes
0
answers
31
views
My Node js app add Javacript script file not working click
My pug file
doctype html
html(lang="en")
head
meta(charset="UTF-8")
meta(http-equiv="X-UA-Compatible", content="IE=edge")
...
0
votes
0
answers
19
views
Xttp send not sending a request body
I currently have a 3 file setup to run on Nodejs: my server, a script for my pug file and a pug file. I want this line of code:
b1 Click on the button to open the dropdown menu.
label(for="...
1
vote
1
answer
146
views
How can I include pug templates in compiled typescript?
My nodejs based application uses Pug for rendering; specifically, i set the view engine and then set the view directory (which lives inside of the src directory that all other source lives in.
app.set(...
0
votes
0
answers
13
views
Webpack 5 SCSS and JS save returns old version of page
I work with webpack 5. Pug works well - after autosave or cmd+S I get new version of page. And it doesn't work so with JS and SCSS: SCSS autosave works well but after cmd+S I get some old version of ...
0
votes
1
answer
24
views
How to collect input from a form using node and pug
very new to Node.js and pug, I'm trying to collect form info and store it in a variable to be used elsewhere.
Here's my form:
form(id="cityForm" action="/courses" method="POST&...
0
votes
0
answers
16
views
How to add PHP syntax highlighting in Pug files?
I need to write PHP code in Pug files for a project.
How can I extend pug syntax highlighting with PHP syntax, without recreating a full language syntax?
For example, for this piece of code, I would ...
0
votes
0
answers
23
views
Using PugJS in Flask
Hej.
How to change template engine in flask?
I don't like Jinja, I want PugJS as my template engine.
Tried to google it but all I found was tutorials of Jinja.
0
votes
1
answer
82
views
Emojis and Special Characters not rendering on Subject Header in Pug using Sendgrid
Please the issue is that any emoji or special character are not rendering on the subject header of the pug file. but working perfectly on the body. I compile both body and subject header differently ...
0
votes
1
answer
13
views
Rendering Mongo document values in Pug template w/ Express
I'm retrieving documents from Mongo Atlas using the new data API like this :
axios(config)
.then(function (response) {
console.log(response.data);
res.render('profile', {
snippets: ...
0
votes
1
answer
27
views
How to prevent normal cursor behavior when pressing keys in a textarea
I have the following code
textarea#main-text-area(
rows="1"
ref="textArea"
maxlength="4096"
v-model="message"
:...
0
votes
1
answer
22
views
Pug - unable to get past step 1 of a boilerplate
total noob question but I cannot find any solutions to this sorry so last resort is to ask here.
I am trying to learn pug. Have created a boilerplate project and unable to render index page. Ive ...
0
votes
0
answers
25
views
static build on multi language web gives unknown filter ":en" yarn
I am making web on pug, node.js and yarn. I can run site locally, but can't make a static build.
My console log:
yarn build:static
success Already up-to-date.
$ rimraf static/assets
$ cross-env ...
0
votes
0
answers
16
views
Why does my internal hyperlink not work in pug?
I am working on a personal blog that has multiple sections on the same page and I would like to navigate to the different sections by linking them at the top with an anchor tag.
The URL changes in the ...
0
votes
0
answers
46
views
How to pass a pug form value to nodejs function
I currently have a form with just the date field in Pug:
form#myForm(action='/myForm', method='POST' name='myForm')
div.form-group
label(for='archiveDate' name='archiveDate') Date:
...
0
votes
0
answers
111
views
update pug variable with client side javascript onchange event
I have server side code which serves up a pug file, the pug file has variables parsed to it when rendered by my server side code.
I would like to be able to update that variable in pug when a check ...
0
votes
1
answer
40
views
Modal content duplicate
So the button works content works fine but until I click on the button it duplicates the first array content, I have tried using the solutions to the other answers on another stackoverflow post but ...
0
votes
1
answer
32
views
Vue Pug Computed Property
Trying to get pug integrated into an existing Vue3 project. After installing pug and pug-plain-loader, the variables from my computed properties no longer work.
Old Code (no pug, works):
<template&...
1
vote
1
answer
86
views
How to include image in email template using pug and img tag?
Whenever the email is sent to the user, the image isn't loaded and the alt text appears. This is the img tag that appears in the inspector whenever i open the email in the browser.
<img src="...