pug

Display data inside input value using Jade

喜你入骨 提交于 2019-11-29 13:19:00
问题 I'm fairly new to Jade and am wanting to display some outputted data as the value value of a text input . Like this: input(type="text", name="date", value="THISRIGHTHURR") But only the value needs to be viewpost.date . I've tried multiple ways and none seem to work: input(type="text", name="date", value=viewpost.date) // doesn't work input(type="text", name="date", value=.=viewpost.date) // doesn't work input(type="text", name="date", value=".=viewpost.date") // doesn't work I of course can

How to pass variable from jade-loader to a jade template file?

我怕爱的太早我们不能终老 提交于 2019-11-29 11:45:29
I want to pass my data-object to jade files, but but it is impossible My jade-loader : { test: /\.jade$/, loader: "jade", query: { pretty: true, locals: { name: "Georg" } } } plugins : plugins: [ new HtmlWebpackPlugin({ filename: "index.html", template: "./src/jade/index.jade" })] index.jade : span=locals.name I run webpack and I get this index.html : <span></span> My variable name don't pass. Why? How to fix it? you should use pug-html-loader then in webpack.config.js ... { test:/\.pug$/, exclude: ['/node_modules/'], loader: 'pug-html-loader', query: { data: {name:'test'}, pretty: true } }, .

Auto-compile Jade in Webstorm on Windows

孤街浪徒 提交于 2019-11-29 07:23:54
I recently discovered Jade and want to give it a try for a new static website. I like the terse syntax and the templating capabilities, so much better than raw HTML. I'm editing in Webstorm 6, which has support for file watchers, and can run e.g. Sass out of the box. I've been able to run Jade via the command line to watch my Jade files: jade --watch --out public jade I'm now trying to configure my project in Webstorm to handle this automatically, and I'm running into problems. To keep the source files separate from the generated ones, I'm aiming for a layout like this: root jade index.jade

Having problems with passing array to jade template in node.js

前提是你 提交于 2019-11-29 07:04:51
I am trying to pass array of news to display on the screen but I somehow am getting empty array in the result in the browser routes/rss.js ... var news = []; ... var this_news = { 'title': item.title, 'description': item.description } news.push(this_news); ... res.render('rss', { title: 'Node.js based RSS reader', newsi: JSON.stringify(news) }); views/rss.jade extends layout block content h1= title p Welcome to #{title} p Sure why not script(type='text/javascript'). var inews = !{newsi}; EDIT Ok so I have come to the conclusion that the problem lies with my 'non-callback logic' that's my code

Access element whose parent is hidden - cypress.io

拈花ヽ惹草 提交于 2019-11-29 06:17:40
The question is as given in the title, ie, to access element whose parent is hidden. The problem is that, as per the cypress.io docs : An element is considered hidden if: Its width or height is 0. Its CSS property (or ancestors) is visibility: hidden. Its CSS property (or ancestors) is display: none. Its CSS property is position: fixed and it’s offscreen or covered up. But the code that I am working with requires me to click on an element whose parent is hidden, while the element itself is visible . So each time I try to click on the element, it throws up an error reading : CypressError: Timed

Jade - Loading templates from different directories

╄→尐↘猪︶ㄣ 提交于 2019-11-29 06:14:54
问题 I'm trying to work on Peepcode's Node.js Full Stack videos and it seems they're using an older version of express/jade. No mention of using block/extends to render layouts. The setup used in the app is to have a /views/layout.jade file that loads for all sub-apps. The sub-apps' views are located in /apps//views. My server.js seems pretty standard. Express is version 3.0.0rc1 require('coffee-script'); var express = require('express') , http = require('http') , path = require('path'); var app =

help with displaying a variable in jade express

守給你的承諾、 提交于 2019-11-29 05:40:17
I'm trying to load some variables with res render like that: res.render('blog_edit', {title: 'edit your blog', posts: "something"}); though title loads fine post always appears as undefined... here are some of the ways I tried... =posts #{posts} and as a javascript variable script document.write(posts) none of them is working... can you please help? thanks in advance try res.render('blog_edit', {locals:{title: 'edit your blog', posts: "something"}}); #{locals.foo} I'm using the latest versions today ("express": "4.11.2", "jade": "1.9.2") and this is the syntax that works for me: res.render(

Do I have to use   for space in Jade?

谁说胖子不能爱 提交于 2019-11-29 05:26:29
I am using Jade and everything is cool except that Jade "eats" my spaces. For example, in HTML: <b>Hello</b> <b>World</b> or <b>Hello</b> <b>World</b> Will have a space between "Hello" and "World". But when converting to Jade it'd be b Hello b World When rendered as HTML, the space is gone. Like: <b>Hello</b><b>World</b> Do I have to add   in my Jade template or is there any way I can get a normal space in the generated HTML? This should do it: b Hello | World Unfortunately it produces this HTML output in Chrome on my machine: <b> Hello World</b> But in the end it becomes: To come to an end b

Jade: How to include a javascript file

≡放荡痞女 提交于 2019-11-29 04:26:54
问题 I need to include a javascript file to webpage. I write the following: include /../scripts/jquery.timeago.js but I get <script>/* * timeago: a jQuery plugin, version: 0.8.2 (2010-02-16) * @requires jQuery v1.2.3 or later * * Timeago is a jQuery plugin that makes it easy to support automatically * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). * * For usage and examples, visit: * http://timeago.yarp.com/ * * Licensed under the MIT: * http://www.opensource.org/licenses

Using Jade to iterate JSON

老子叫甜甜 提交于 2019-11-29 03:36:43
I am trying to iterate a JSON doc using JADE. my server(running node.js + express) is doing the following on a .get() request, app.get('/search/', function(req,res){ // Parse the query var dbQuery = url.parse(req.url, true).query; var product = dbQuery.product; var category = dbQuery.category; console.log('Searching for: ' + product + ' in ' + category); //Mongo DB setup then query var result; var server = new mongodb.Server('23.23.129.158', 27017, {}); new mongodb.Db('militaryListDB', server, {}).open(function(err, client){ if(err) throw err; var collection = new mongodb.Collection(client,