Questions tagged [pug]
Pug (formerly known as Jade) is a robust, elegant and feature rich template engine for Node.js.
0
votes
1answer
6 views
Ionic Jade mask text input
I'm building an iOS app using Ionic and am using Jade for UI. There is an input box that I want the value typed to be masked. The input could be numeric or numeric+alphabetical. So far, I couldn't ...
0
votes
1answer
15 views
href in pug-php not working
Hi does anyone know how to use href in Pug?
What I want to achieve is this:
<noscript class="lazyload">
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/...
-2
votes
0answers
20 views
Data table is initialized twice , once empty tbody and once reponse from api call is rendered
I am writing application using Jquery, Javascript, nodeJs and Pug(Jade) in my code. My Data table is initialized twice, once empty tbody and once reponse from api call is rendered.
When my page is ...
-1
votes
0answers
14 views
Hoe To Add paragraph alignment to PUG
I have this code currently, :
doctype html
html
head
title= title
style.
body {
font-family: Verdana;
font-size: 13px;
...
0
votes
2answers
14 views
pug variable not evaluated on a href tag
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"];
...
0
votes
0answers
8 views
migration to pug 2, attribute interpolation
according to migration and attributes docs, I changed my:
each item, index in data
tr
td!=index
td
a(href="#{item.link}")
to new attributes interpolation style:
each item, index in ...
0
votes
2answers
37 views
Helps with modals and buttons with for loop ( Semantic Ui)
I have multiple buttons in a for loop. I want to show only one modal when I click a button, but now it shows all modals for every button when I click the button. I want to show one modal for each ...
1
vote
0answers
11 views
Converting Express app view engine from Pug to Handlebars
Will converting view engine from Pug to Handlebars improve performance. It takes a really long time for my app to load on Heroku. I read somewhere that Pug is slower than Handlebars. I am wondering ...
0
votes
0answers
7 views
Gulp-changed not compiling pug partials
It seems as if gulp-changed does not compile new HTML files once a pug partial (i.e. _modules) changes.
gulp.src('src/views/labelpages/**/*')
.pipe(changed('dist', {extension: '.html'}))
.pipe(...
0
votes
1answer
28 views
How to use the modulo operator in pug/jade?
I am new here and a new developer, so please don't judge me.
My question is, I want to build a table with pug, and very second row should be in different style.
This is what I have done:
table.table....
200
votes
3answers
346k views
Client on node: Uncaught ReferenceError: require is not defined
So, I am writing an application with the node/express + jade combo.
I have client.js, which is loaded on the client. In that file I have code that calls functions from other JavaScript files. My ...
0
votes
1answer
33 views
Pug.compile : unexpected text “;pug_”
I'm working on the password reset functionnality in a node.js express app, for that I intend to compile a pug template, it's output is sent to the user with a reset token as a mail.
Pug is already ...
3
votes
1answer
48 views
How nested loop works with jade?
How nested loop works in jade?
I am trying to generate multiple div with increasing and decreasing value in class attribute. I am trying below jade syntax for that and getting very weird output of 60 ...
2
votes
0answers
32 views
Pass a variable containing a function from pug to react component
QUESTION
How can I pass a variable containing a function from a pug file (I don't think it's specific to .pug files) to a react component?
route.js
const login = () => { ... 'log the user in ...
1
vote
0answers
16 views
(nodejs webpack) A waste bundling all jsx files?
I got a lot of .jsx files and static .pug (formerly known as jade) files. In every one of these I typically have around one or two .jsx files that I need to use but before I can use them I will have ...
8
votes
2answers
4k views
can i use pug (ex-jade) with react framework?
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 ...
1
vote
0answers
20 views
jade nodejs Multiple buttons with modals
Hi i have multiple buttons in for loop, i want to show only one modal when i click the button, but now, it shows all modals(multiple modals for every button) when i click the button. how do i fix the ...
3
votes
4answers
9k views
Pug Templates - How to mark option in Dropdown list as selected
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 looking ...
0
votes
1answer
39 views
Is it Possible to serve a Client Side React Component / Application in a server side Express Route?
I have an Node/Express backend that is using Pug.js to render a number of server side routes. The application is static at the moment and is a simple site.
I created an interactive "builder" ...
0
votes
0answers
29 views
Can't Access Elements In JSON Using Pug And Node.js
I'm doing an API request like this:
router.post('/info', function(req, res, next) {
var dataString = '{"jsonrpc":"2.0", "method":"follow_api.get_blog", "params":{"account":"' + req.body.name ...
59
votes
10answers
61k views
What about Line Breaks in Jade?
I'm pretty sure that this is a no-brainer but I didn't find any snippet of sample code.
What's the best way to insert line breaks (aka the good ol' br/)?
As far as I can see if I put a "br" at the ...
2
votes
2answers
6k views
Pug (Jade) HTML form
I'm trying to create the following simple form with Pug:
<body>
<form action="/add_movie" method="POST">
<p>
title: <input type="text" name="title" ...
0
votes
0answers
12 views
pug - create a layout for header including login / logout links
In my Express JS web app, I need to create a layout view that is attached to every other view as included. The layout is supposed to contain a header and a login or logout link depending user ...
0
votes
0answers
10 views
Node Koa endpoint with a subpath. Serves blank static files. Using koa-pug
I have created a node server using the koa framework and pug as a templating engine. The issue is when I use a subpath endpoint e.g.
const router = new Router({ prefix: '/post' })
router.get('/:...
0
votes
1answer
45 views
How to get checkboxes to behave like radio buttons with using the same name
$("input[name='yesFollowup']").on(element_click, function(e){
if($(this).attr("id") == "yesFollowup"){
$(".phone_number_yes").show();
}else{
...
0
votes
0answers
70 views
Firebase Functions can't find pug
I have a simple firebase function that renders a pug template.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const creds = {
projectId: "retnikt-blog",
...
-1
votes
0answers
22 views
Run react (jsx) in pug file
I am running a ndoejs application in which I want to run some jsx code from a script tag in a pug file. But how can that be done?
doctype
html
head
include ../partials/header.pug
...
0
votes
1answer
18 views
In Express App pug div class repeat with MySQL data
Now I'm developing Express-NodeJS version of my portfolio page.
You can access static web page with this Link
So I put my data in MySQL Server. In the Pug template I want to repeat the div element ...
0
votes
1answer
24 views
Can only http module render ejs to html and pug to html?
in case http module , it have option to encode utf8 but i think there is no option in express module , is it true? there is now way to render by express?
const express = require('express');
const ejs ...
0
votes
0answers
13 views
JADE - Button is not working as expected
I have this API code that goes out to my DB and updates my table to set apples to GONE
app.get('/update/apples', function (req, res) {
sql.connect(config, () => {
const ...
0
votes
1answer
20 views
Button does not show in jade .. shows the code
I've an API that will delete a user from my SQL table. I want to executethe delete user API call from a button on my pug index page that is within a table view.
I have the following code, but it ...
0
votes
1answer
18 views
Nodejs Update SQL DB based on parameter from URL
Anyone able to help me out on this code .. What i expect to happen is when i hit thie URL I want it to update the DB Table with the user_name that is passed in the URL
Example: A user goes to /update/...
0
votes
0answers
13 views
How to download files (.docx) defined in pug with Node.js?
I'm trying to download files using Node.js (Express) and PUG (I am new to web development) when I click a button. For the moment I have a search engine and I am able to download all the files that ...
2
votes
2answers
5k views
jade doesn't let me use include #{variable} in a mixin
I want to print an include as a result of a mixin, but jade wants to parse the include when it first reads the mixin.
mixin myHeader(name)
div#{name}
h1 #{name}
include #{name}
!!! html
...
3
votes
1answer
2k views
How to use angular2 html binding in jade? Specifically a([router-link]=[“/Default”])?
So I have an issue as mentioned in the title.
Jade compiles
li([router-link]=\["/Listen"\]) Listen
to
<li [router-link]="/Listen">Listen</li>
where I need
<li [router-link]=["/...
4
votes
1answer
3k views
How to set up webpack for Pug, React, and ES6
I’m trying to make a website using React and ES6. I’m using Webpack to transpile my JS using Babel and it works fine. Now I need to know how to write my template in Pug (or HTML for that matter) and ...
0
votes
0answers
23 views
SemanticUI modal not /onShow/onDeny/onApprove every events not firing
Every events are not firing in my modal..
log should be appear when modal shows, and also should be appear when i press the deny and approve buttons but its not print any log, but only close the ...
0
votes
0answers
12 views
semantic-ui modal, nodejs and pug
Hello i want to call post method when i click ok(Yep!) button in modal
button.mini.ui.red.basic.button#delete(type="submit")
|Delete
.ui.mini.modal.myModal
i....
0
votes
3answers
78 views
Is there a way to use pugjs in svelte components?
I'm trying to rewrite my app made with pugjs and express in sveltejs. I really like to write html in pugjs. I was wondering if there is anyway I can use pugjs in svelte components. I am assuming I may ...
0
votes
0answers
25 views
Bootstrap seems to be messing with my navbar
In my view template, I am using bootstrap but am adding my own nav bar through css. But the items won't align to the center.
When I take bootstrap out, they align perfectly. It's really frustrating ...
0
votes
0answers
16 views
Why does this Express/Pug code crash when app launched with nodemon but not with node?
I'm learning Express with Pug and reached a point in my project where I consistently got a crash with a server has refused connection error when trying to render a Pug template. It happened, ...
0
votes
1answer
31 views
Is there a stop processing and exit command?
Instead of nesting many if then/else blocks resulting in deep indents in a pug script, is there an option to stop further processing and simply exit?
I tried:
- return
but it returns a blank page.
0
votes
0answers
23 views
Rendering image onto server-side using base64 not working correctly
First off - this is my first post on here, and so I preface this question with a big thanks for the many months of anonymous help I've received in the process of building my first real site. That's ...
0
votes
1answer
23 views
pug form input type=text attribute 'size' not working?
Just learning pug from some online example and wanted to experiment restricting the size of a form's text input length to 20 characters.
input#first_name.form-control(type='text' placeholder='First ...
0
votes
1answer
23 views
How to define inline variable in Pug
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 ...
0
votes
2answers
44 views
NODEJS, PUG, EXPRESS - Cannot read property 'length' of undefined
I have an API that i tweaked to make 2 calls to my DB and pull down information .. I can see the results in my console log so i know it is working
The next part is when it renders the view i need to ...
1
vote
3answers
1k views
Interploating values in HTML attributes - Pug(Jade)
I am trying to construct an anchor tag with href attribute interploated in Jade.
I did go through http://jade-lang.com/reference/interpolation/ and some SO questions but didn't help me. This is what ...
5
votes
1answer
835 views
Uploading files and JSON data in the same request express node js
I have the below form written in JADE
<form id="formAddchallandetails" action="/adddata" method="post" name="adduser">
<input id="inputunloadingDestination1" type="text" name="...
0
votes
1answer
32 views
Pass variable from app.get to pug view
I have the below code that make a call to my DB and pulls down info
// GET the number of apples left in stock
app.get('/apples', function (req, res) {
sql.connect(config, function() {
...
0
votes
1answer
393 views
Pug support for Angular 2 / Angular 4 / Angular 6 / Angular cli / Angular cli 6 (without custom WebPack config)
How to install correctly PUG / JADE to Angular 2 or above
So that while working and AOT and JiT
Worked Unit and Integration Tests
and do not suffer much when creating each new component