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.

Is it possible to send objects to the client using node, express, and jade?

My query on the server is quite heavy and it results in a new page render. I want to send some of the query results to the client as a JavaScript array of objects. This way, I can avoid making a separate JSON query later to retrieve the same content, which ...

Adjust the width of a textarea to expand evenly within its container when exceeding the specified width limit using CSS

I am currently attempting to adjust the size of this textarea proportionally. However, when I try to increase it beyond 100% width, it only expands to the right side. I have already experimented with using margin: auto and display: block but unfortunately, ...

Troubleshooting the malfunction of images in Node.js located outside the HTML path

Currently, I'm developing a user profile page using nodejs where users can view their avatars after logging in. Users are able to upload files to the uploads folder which is located outside the standard htmlpath. Here's an overview of my folder s ...

Fetching various data from MongoDB using NodeJS and presenting it in Jade(Pug) template

I am working with MongoDB collections and need to showcase them on my website, creating a dynamic page that updates automatically. Specifically, I am dealing with team members' information in the database. Here is an example of how my collections look in ...

Mongoose - embedded documents are stored as text data

Within my node application, I have a designation model that utilizes the following Schema: var DesignationSchema = new Schema({ _id : ObjectId, designation : String }); This DesignationSchema is then embedded within the users Schema. var UserSch ...

A guide on retrieving information from a deeply nested object using pug

Is there a way to access data from a nested JSON object without the use of JavaScript in PUG? I need to loop through product highlights and extract the heading property. JSON FORMAT [{"id":"0.33454785604755677","title":"Product 2 Title", "hig ...

The gulp-pug plugin is malfunctioning and displaying an error message stating "unexpected token 'indent'"

There seems to be an issue with gulp-pug indicating an unexpected token "indent" Please refer to the images below for further details: gulp code and nodejs command prompt index.pug and nodejs command prompt package.json and nodejs command prompt I am ...

Encountering an issue with the Jade Template Engine while utilizing a layout option

I am currently working on an application where I want the sidebar navigation to remain consistent across all pages. To avoid redundancy, I plan to create the navigation in the layout file and then include it in other jade files. Below is the content of th ...

What could be the reason my Backbone view is failing to render?

Can anyone help me troubleshoot why this template isn't rendering properly in my backbone views? Any insights would be greatly appreciated! Below, I've included the code from my jade file for the views and the main.js file for the backbone js script. Jade ...

Activate and Deactivate Link in Bootstrap Navigation Bar

After reading numerous posts on the topic and trying the same solution without success... The issue I am facing is that I want to implement Twitter Bootstrap 2.3.2 and its navbar. I have included the necessary css and js files along with jQuery. Initially ...

Jade is unable to interpret variable within the jade file

I'm having an issue with reading variables in my express.js + jade project. /index.js var boardgame={ grids:['a','b','c'], winer: 'No' } var jfile=JSON.stringify(boardgame); res.render('index2', { ti ...

Acquiring data within a jade template in order to generate static HTML pages

I am struggling to pass data to a jade template in order to generate static content. While I am not well-versed in node.js and express, I use jade as a template engine for creating static html. Many of the requests in the jade issue list pertain to includ ...

Encountering issues when attempting to integrate axios with a pug template

I am currently attempting to integrate axios with a pug template but encountering an issue. Here is the code I have written: doctype html html head block head meta(charset='UTF-8') meta(name='viewport' content='wi ...

Using Express.js with Pug.js, dynamically render the page with new content following a fetch POST request

I have a collection of article previews sourced from a database and rendered on the webpage using a Pug.js mixin. each article in articles +articlePreview(article.title, article.text, article.imgSrc) To enhance the user experience, I want to implem ...

Struggling with executing CRUD operation using mysql and Node JS

I am currently working on implementing CRUD operations for my Node.js application, utilizing MySQL as the database. Below you can find the code snippets I have been using for this purpose. I would greatly appreciate it if you could review the code and poin ...

Having trouble getting req.files to work in a Node.js Express application?

Hello there, I'm facing an issue with accepting an uploaded file. Every time I call req.files, it comes out as undefined. I can't seem to figure out what I am doing wrong... Below is a snippet of my app.js file: var express = require('expr ...

What could be causing some of my images not to appear on the screen?

I am encountering an issue while using Express.js with Jade. I have 6 images, but 2 of them are not displaying on the page. Even though I can access all 6 images at `local:3000/images/a.png`, two of them are not visible on the webpage. Below is a snippet o ...

Assigning values to template variables in Express 4's routes/index

Recently, I started using node.js and express. To set up express 4, I used the command "express myAppName" in the terminal, which created a default directory with Jade templates as default. The main file, app.js, has the following standard express boilerp ...

Tips for resolving the JSON array iteration issue in Pug

I'm having trouble displaying JSON data in tabular form using the Pug view engine with Node and Express. I attempted to use a forEach loop in my Pug file. Here is a snippet from my app.js file: const express = require("express"); const path = require("p ...

How can I send back multiple error messages from a pug template in a node.js application with Express?

I am currently working on validating inputs from a form on a Node.js web server using Pug.js and Express.js. The issue I am facing is that when there are multiple problems with the user's input, only the first error is displayed to the user. How can I mo ...

What is the alternative HTML file to use for displaying web content if render is not being utilized?

When creating a project in Node.js without using render, which HTML file will be used to display content on the web with res.send('respond with a resource')? app.js var createError = require('http-errors'); var express = require('express'); var path = req ...

My custom CSS being overridden by Bootstrap styles

I'm currently working with Twitter Bootstrap's CSS, but it seems to be overriding some of my custom classes. Initially, I placed it before my own CSS in the HTML header (I am using jade and stylus template engines): doctype html html head title= ti ...

Running pug directly from the local node_modules directory

I'm currently attempting to run pug (/jade) from my node_modules directory, however I am unable to locate the executable within the node_modules/.bin folder. I am running MacOS 10.12.5 and installed pug using the "npm install --save pug" command. Is th ...

Removing comments in Express / Pug: A simple guide

Currently, I am working with Express and Pug as the view engine. In Pug, comments are also rendered in the HTML output. For instance: div // This is a comment p Hello This code would result in the following HTML output: <div> <!--This is a ...

Developing web applications using Express.js and Jade involves connecting CSS stylesheets

I'm currently in the process of developing a web application using Express.js along with some Bootstrap templates. I utilized jade2html for conversion, and while the page loads successfully, it lacks any styling. The following code snippet is what I ...

Differences between Angular2 local template variables and Jade ID shortcutsIn Angular2, local

Angular2 has introduced the local template variable feature, which is created using #var. When using the Jade Template Engine, this syntax gets converted to #var="var". Is there a method to avoid this conversion? Otherwise, accessing the original local t ...

Can you provide me with the URL for the jQuery post function?

Could someone please clarify which URL I should use in the $.post call to the server for a node.js file? Most tutorials demonstrate with PHP files, but I'm unsure about calling node.js files. Should I post it to the app.js file or the route file? This is ...

Tips for enabling editing on the result column by clicking the edit button

Each time I click on the Edit button, I want to be able to change the output in the column {{ test.result }} by turning it into an input element. This will allow me to update the numbers and then save them. Attached is a screenshot showing how the column ...

Concealing Enclosures in Jade - AngularJS Syntax

Struggling with writing this in Jade, specifically the .get() function is giving me trouble. <li ng-repeat="breadcrumb in breadcrumbs.get() track by breadcrumb.path" ng-class="{ active: $last }"></li> Seen from: https://github.com/ianwalter/n ...

Utilizing Mongoose for incorporating embedded documents within forms

Within my Mongoose schema named Question, I have a straightforward setup for storing questions and their corresponding answers. Answers are defined in a separate schema and stored as embedded documents within the Questions collection. Below is the outline ...

Learn the process of utilizing JavaScript/Node.js to dynamically upload images onto a webpage directly from a database

Currently, I am developing a web application and building a user profile page where I aim to showcase user information along with a profile picture. Working with node/express/jade stack, I have a javascript file that manages loading the appropriate jade vi ...