Questions tagged [pug]

Pug, formerly referred to as Jade, is a dynamic and sophisticated template engine designed for Node.js, offering an array of powerful features.

Transferring form data from Jade to Node.js for submission

My Jade template includes the following form structure: form(action='/scheduler/save/' + project.Id, method='post') div.form-group label.control-label.col-md-2 RecurringPattern div.col-md-10 ...

if jade is being inconsistent

I am currently using expressjs in my app and have the following setup: app.get('/profile',index.profile); app.get('/',index.home); Within layout.jade, I have the following code: ... if typeof(username)!=='undefined' li: a(href='/log ...

Exploring the mechanics of form data handling with node, express, and jade

What are some best practices for processing HTML form data using Express and Jade templates? I was considering implementing a self-calling loop similar to PHP in the router script, where there are two handlers for the same route - one for GET requests and ...

A guide on displaying data in a table using a select dropdown in a pug file and passing it to another pug file

After creating a single page featuring a select dropdown containing various book titles from a JSON file, I encountered an issue. Upon selecting a book and clicking submit (similar to this image), the intention was for it to redirect to another page named ...

using express to display events and gatherings from external websites

I've created a simple Express application with a single function that utilizes the nodejs request and selects specific div elements. My goal is to then render this using jade. var express = require('express'); var voc = require('vocabulaire'); var async = ...

Is Jade monitoring *.jade files?

Though I am not sure of the internal workings of Jade, my best guess is that it compiles each template file once and then employs a compiled and cached version for subsequent HTTP requests. One intriguing observation I have made while running my Express a ...

Having trouble with the express message! I can't seem to access the template I created

I am looking to receive a notification similar to an alert, as described in this link: https://github.com/visionmedia/express-messages By default, I receive something like this https://i.stack.imgur.com/9XlA9.png If I use a template, I do not get any out ...

Optimal Procedure for New Users Form (Jade / Angular) in HTML

I'm currently working on integrating a form into my app for users to create tasks. This form should only appear the first time a user attempts to create a task. As someone who is not very experienced with frontend development, I find myself wondering ...

Data is not loaded until after the HTML for the Nuxt page has been

My issue is that I have a dynamic page where product details are loaded, but the html code loads before the data. This results in errors when trying to use static elements like images because the "product" object does not exist. To address this problem, I ...

The problem arose with the Jade template engine

I've been attempting to pass values into a jade template using a node/express route, but for some reason, nothing seems to be getting passed through. Below are both the server and template code snippets I am working with: server.js: app.get('/note/:id', ...

What is the best way to incorporate conditionals into loops when working with Jade?

I've been working on targeting a specific element within an iteration. each category in categories .menu_category p= category.category_name The code above is in Jade and it's looping through an object called categories. As I' ...

Looking for clarification on Jade syntax

Currently, I am exploring Huge's latest Styleguide templates and delving into Jade syntax. However, despite my efforts, I haven't been able to locate any documentation on how the image paths were created by the author. The specific syntax used is ...

Pug (Express framework view engine) integration with conditional statements

I'm currently using Pug as my view engine for Express (Node.js), and I'm running into some issues with conditionals. The grid framework I am using for newsletter designs is similar to Bootstrap's grid, where I need two items per row that req ...

delivering axios response to display the page

I have a code snippet that requests data from an external API using axios and I want to incorporate the response into my rendered page. Here is my code: //Snippet from my controller required in main routes exports.recordBySlug = async (req, res, next) =&g ...

When employing Pug, static files are not served by Express

Having trouble serving static files with Express and Pug as the templating engine. My assets are not loading correctly. Directory structure : +front +views +login index.pug +images +js +css ... server.js Server code : ap ...

Is there a way I can set a variable as global in a jade template?

I am trying to pass a global object to a jade template so that I can use it for various purposes later on. For instance: app.get("/", function(req, res){ var options = { myGlobal : {// This is the object I want to be global "prop ...

jade - implementing conditional logic

How can I achieve the following if condition in jade? each item,count in display if(count % 3 === 0) { ul.thumbnails } li.span6 //nested under ul //more code nested under li I have sea ...

Executing Client-Side Function Upon Data Retrieval in a Node.js Application

Within my node.js Express application, there exists a route like this: router.get('/devices/:id/visualize', catchErrors(deviceController.visualizeDevice)); This route points to the following controller: exports.visualizeDevice = async (req, res) => { ...

Utilizing Folders in Views on Your Express Application

Within my views folder, I have a pug template named fixed-assets.pug located in views/administration/assets/ The main template default.pug, which the fixed-assets.pug extends from, is situated in the root views directory. Upon attempting to render the fi ...

"Sharing the entire contents of a table with Jade through node.js: A step-by-step guide

Is there a way to transfer all rows from the original console output to Jade using node.js? Currently, only one row of the WCF service is being sent to Jade. var response = result['s:Envelope']['s:Body'] [0].OrderReportResponse[0].exe ...

Using Pug/Jade, be sure to call a function during each loop iteration

I'm attempting to develop a basic app, similar to a TO-DO LIST. I want to generate divs dynamically (with incremental ids) when a Button is clicked and then enter some text into an HTML input field. For example: <div id="item1"> <div id="ite ...

What is the best way to send an array of objects to a Jade template?

I'm looking to retrieve an array of objects from MongoDB and pass it to the client... Here is an example object: var objeto_img= { name:'name of the file', ...

Using a pug file results in an error, while jade functions perfectly

I'm facing a strange problem here. I have a simple jade/pug include setup like this: extends base.pug block vars - var title = 'Home' block body header include ./includes/header.pug A quick observation, using just extends base (without ...

What does this swig syntax appear as when written in jade?

I am currently learning how to develop a meeting web application using express. During the lecture, swig was used, but I personally prefer using jade as I am more familiar with it. I am in the process of translating swig code to jade, and I'm encountering ...

Working with variables passed from Node.js in Jade processing

Currently, I have a situation where my script is sending a matrix that looks like this: [[1,2,3,4], [7,6,5,4], [2,3,4,5]]. After sending it using res.send(JSON.stringify(dataArray)); and viewing it in jade with h1#results, I can see that the format appears ...

The idleTimer plugin appears to be malfunctioning

I have been working on implementing an automatic logout feature for users who remain idle for a specific amount of time on a particular page. My approach involves using jade files to structure the layout of my html pages. I attempted to integrate the idleT ...

Can dates in the form of a String array be transmitted from the server to the client?

Struggling to send a String array from the server side to the client using Nodejs and Pug. Encounter errors like "SyntaxError: expected expression, got '&'" or "SyntaxError: identifier starts immediately after numeric literal". Server runs on v10.15.0 ...

Insert code into the notes section of Pug

Need help inserting a script into a comment on Pug? I have two scripts that need to be added to my website: <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="http ...

Update the code from a template engine to Next.js

I have a .pug app and I want to convert it to a next app. My current app uses the .pug engine, but I know that Next.js is different. How can I go about converting my app to Next.js? Currently, my files are in the views folder and within the views, the fi ...

Pass the returned variable value from a request.get call to another function in NodeJS Express

I have a situation where I am calling a function that makes a request to get some JSON data and then fills in the variables from my router.get method. The issue I am facing is that the variables are getting their value inside the callFunc function, but wh ...

Express identifies the user, however, the username is displayed exclusively on one specific page. This situation may indicate a potential cookie problem

I am in the process of developing an express app integrated with MongoDB. The issue I am facing involves a pug template for the navigation bar where I aim to display the user's name at the top upon logging in. Strangely, it only works on the page that the ...

When attempting to display a sub view in Express, a 404 error is encountered

I am currently working with express and jade to display a web page. My intention is to render the page using this format 'http://127.0.0.1:5000/services/landfreight' but I keep encountering a 404 error. router.get('/service/landfreight', function(req, res, ...

Assign a unique ID to each Angular Material checkbox

Presently, I am facing an issue: I am required to generate md-checkboxes from a Database. The implementation is successful using ng-repeat. However, I am encountering difficulties in fetching the data from these checkboxes. Each entry in the Database has ...

Guide to setting up npm pug-php-filter in conjunction with gulp

I'm having trouble setting up pug-php-filter (https://www.npmjs.com/package/pug-php-filter) with gulp in order to enable PHP usage in my Pug files. Any assistance would be greatly appreciated. ...

"Error: Trying to access form data in Node Express 3.4.4 with Jade returns

The code below is part of the app.use section // Setting up redis session store app.use(express.cookieParser()); app.use(express.session({ store: new redisStore({ host: 'localhost', port: 6379, ...

Jade block refuses to render

I seem to be overlooking a small detail. Currently, I am experimenting with jade templates in express and trying to utilize blocks and extensions. However, my block does not seem to be functioning correctly. Below are the jade templates I am working with: ...

What is the best way to pass parameters using query or route in a form?

form(action='/allusers', method="post") input(id='name', placeholder='First Name / Last name') button(type='submit') Launch Spacecraft In my HTML (Jade) code, I am trying to redirect to the allusers page ...

Stop Jade from collapsing the directory hierarchy

When it comes to implementing a build solution using NPM scripts instead of Gulp or Grunt, I have been facing some challenges in managing multiple Jade files efficiently. I've referred to resources like and for guidance. The Jade CLI allows for compilin ...

Exploring the power of AngularJS with JavaScript and utilizing the $scope

After spending the entire day trying to solve this issue, it seems like I might be missing something simple. Here's the problem at hand: I have a well-structured Nodejs/AngularJS application that utilizes Jade for templating. The server performs certain ac ...

Verify the presence of a GET parameter in the URL

Working on a simple log in form for my website using Jade and ExpressJS. Everything is functioning correctly, except for one issue - handling incorrect log in details. When users input wrong information, they are redirected back to the log in page with a p ...

Tips for resolving rendering page issues in an express app

My application is a straightforward blog platform that showcases a schema for the title, entry, and date of each blog post. There is also an edit/delete feature that is currently under development. When attempting to use the edit/delete button on a selecte ...

What is the process of integrating data retrieved from an SQL query into a Pug template using Express and MySQL?

Currently, I am in the process of developing a basic web application that will initially show a list of bus route numbers and names upon landing on the page. My tech stack includes MySQL integrated with Express and Pug. Below is the server-side code snippe ...

What is the process for implementing the post-redirect-get pattern in a Node.js application?

Currently, I am experimenting with a basic node.js application where I can create and save posts. The process involves displaying the post form using the newPost function and handling the submitted data in the savePost method. After performing validation u ...

Incorporating images with JavaScript in Jade templates

Currently I have a layout.jade code that I am looking to modify the javascript for. My goal is to load an image onto the page every time it is reloaded using jade. Here is the existing code: html head title= title script(src='/libs/jquery/j ...

Express causing textarea in http form to have empty req.body

Here is a form for users to upload a file and submit text: form(action='/createpost' enctype="multipart/form-data" method='post' id="imgForm") input(type='file' name='imgPath' size = "60") br textarea(name="postText" form="imgForm") Enter your ...

Retrieving values from res.send in Jade Template

Having recently delved into the world of node.js and Jade, I've been teaching myself through tutorials on udemy. However, I'm facing some challenges when trying to integrate Jade, Express, and Backbone based on an example. I attempted to use res. ...

Tips for sending data from Jade to a Node.js endpoint function

I am unfamiliar with Express and I am trying to figure out how to pass the user's username from a Jade file to an endpoint function in my JavaScript file. Below is the code for the endpoint function in index.js: router.get('/userdetail', fu ...

How to showcase base64 encoded images in pug (jade) with node.js

Can anyone help with decoding this mysterious data and displaying the image? I'm using pug as my template engine. Below is the questionable data that needs to be shown as an image: /9j/4AAQSkZJRgABAQEAYABgAAD/4QBaRXhpZgAATU0AKgAAAAgABQ ...and so f ...

Pug: perform a task depending on the presence of an element within a variable

I'm currently working with Express js to create a web application. I make use of an API to fetch some data, which is then sent to a pug file in the following format. res.render('native.pug', {product_name: body.products, cart_items:body.cart, item_count:b ...

Tips on invoking a mixin within a Jade template showcased in a Node/Express endpoint

I'm currently developing a component that I plan to use multiple times on a website through a Jade template. This is how my route is set up: router.get('/', function(req, res, next) { res.render('indicators',{category:"", number:"1", title:"whatever" ...

Transitioning server-side rendering to the client-side

I'm currently utilizing the Jade server-side templating engine to render a layout. The initial layout received by the client will remain largely unchanged, with only occasional updates needed for its contents rather than a complete overhaul. Is there a me ...

Unresolved issue with Jade in Angular Routing

Currently, I am working on building a web server using expressjs and jade for the frontend. I have also implemented client-side routing with angularjs but unfortunately, my UI is not displaying as expected. Below you can find my code and the unexpected out ...

How do you display a GET request response onto a Jade page?

After successfully making a GET request to an API, I am now looking for a way to display the response on a Jade page. Below is the code snippet from 'index.js' located in the routes folder where the GET request is implemented. Any suggestions on ...

Jade includes an apostrophe when generating the output

Does anyone know why this Jade template keeps adding apostrophes around variable outputs no matter what I do? The code snippet below shows how it's displaying in the document at the end. Any suggestions? div.col-md-4.col-xs-12 div#currentImg ...

The nested jade elements are failing to render

If I have a jade setup with 3 files as follows: 1. //layout.jade doctype html html body block content 2. //index.jade extends layout block content h1 Animals block cat block dog 3. //animals.jade extends index block cat p Meow block ...

Can I divide certain parts of my template and store them in separate files?

I want to separate the navigation part of my Jade template into a different file called 'navigation.jade'. Is it possible to do that? Currently, I have layout.jade and I would like to achieve something like this: mixin ie(condition, content) | <!--[ ...

Pug and ExpressJS combo failing to implement Tailwind styles

In my project using Express/Node and Pug for views, I've been struggling to incorporate Tailwind CSS for styling. Despite adding the necessary classnames in my Pug files, the styles don't seem to be applying correctly. Has anyone faced a similar issue? ht ...

Best practices for configuring Jade with Yeoman and Grunt for efficient templating

I am struggling with integrating layouts and partials effectively in my project. Can someone provide guidance on the correct setup? Currently, I am using grunt-contrib-jade. Here is my current file structure: app |_jade | |_layouts | | ...

Tips for updating a record by its unique id in Express JS

My aim is to modify a record by its unique identifier. functions.updateClassified = function (req, res) { loadSchema.findById(req.params.classified_id, function(err, bear) { if (err) res.send(err); else l ...

Retrieve the URL with a GET request and remove a specific object

Currently, I am working on developing a CRUD (Create, Read, Update, Delete) App using Express and LowDB. So far, I have successfully implemented the create and read functions, but I am facing issues with the delete function. This is an example of what th ...

Displaying Markdown-formatted blog entries using Node.js and Express

Hi there, I've been diving into Node.js with Express for the past week and I'm really enjoying it. So far, I've grasped the fundamentals of building an MVC framework on top of it, and using JavaScript has proven to be a much cleaner experience compared to ...

How to integrate an AngularJS page into a Node application

Exploring the realm of single page web apps with node, angular, and jade has been an interesting journey for me as a newcomer to angular. I am currently faced with a dilemma regarding my app.js file - how can I ensure that my initial page template loads fr ...

Using AngularJS to Dynamically Set the Default Selection in a SELECT Element

In my code using JADE syntax, I have the following structure: select(ng-model="eventTypeUI") option(ng-repeat="c in eventUI", ng-value='c.value', ng-disabled='selectEventCanNotBeUsed(c.value)') {{c.name}} I chose not to use ...

The Body Parser is having trouble reading information from the form

I'm struggling to understand where I'm going wrong in this situation. My issue revolves around rendering a form using a GET request and attempting to then parse the data into a POST request to display it as JSON. app.get('/search', (re ...

Fetching JSON object from a node.js/express server using AJAX request

I've implemented server-side code to fetch data from an external website and return a JSON object to the client side of my node.js/express application. The intention is to further process this JSON on the client side. Within my index.js file, I have ...

Retrieve data from a RESTful API

Can someone please explain the correct syntax for fetching an API with Node.js? I am trying to fetch it, but keep getting an error stating that 'fetch' is not defined. View image here ...

Challenges Arising from Using Jade Extends

Recently delving into Jade for a new project and finding it to be quite impressive so far. However, I've encountered a little snag with the Extends feature. The block I created doesn't seem to display when rendering layout.jade. layout.jade: di ...

Using MongoDB and Pug/Jade templates with Google Maps API to display multiple markers in

I've been attempting to integrate map location data from my mongodb collection, but I've run into an issue where I can only access one piece of data at a time. I tried looping through the data both on the server-side and client-side to display it ...

Learn how to manage Ajax GET/POST requests using nodejs, expressjs, and Jade Template Engine

I am currently working on a project that involves the use of NODE, EXPRESS, and JADE TEMPLATE ENGINE, as well as AJAX to optimize page loading. However, I encountered an issue when trying to utilize the data received from a GET request in AJAX directly wit ...

Tips for sending a variable from Express to a Jade template

I have searched for answers on this topic, but I haven't found one that addresses the entire process. I am feeling quite stuck. Below is my code: express code res.render('index', {expressVar:"My Example"}); template.jade doctype html ...

Steps for determining the total number of columns in a MongoDB table

I'm curious if there is a way to automate the counting of columns in a mongodb table using .pug. Is there a method to automatically display the total number of columns within a .pug file? ...

What is the necessary step to configure the "basedir" option for Jade in an Express application? (This option is essential for utilizing "extends" with absolute paths)

As I work my way through the peepcode nodejs video and try to recreate the app using the latest express/node versions, I've encountered a minor issue. Here is the current file structure: site - apps - - authentication - - - views - - - - login.j ...

Utilizing the form action parameter within a Jade template

My Jade template includes an HTML form, but I need the action of the form to be conditional based on external information. How can I pass this information into the template? Here is a snippet of my code: In my ExpressJS app: router.get('/report ...

Title Tooltip Capitalization in Vue.js: A Guide

Is there a way to change only the first letter of the title tooltip (from a span) to be capitalized? I attempted using CSS with text-transform: capitalize;, however, it didn't have the desired effect. <template lang="pug"> .cell-au ...

Grunt jade compiler populating attributes with default values

When using the grunt-contrib-jade module to compile my Jade templates, I encountered an issue. If I leave my attribute blank, like in this line of code: article(ui-view) The compiled output becomes: <article ui-view="ui-view"></article> Thi ...