pug

how to pass an array of objects to jade template?

做~自己de王妃 提交于 2020-01-01 12:33:12
问题 i want to pass an array of objects from mongodb to the client... this is the object var objeto_img= { name:'name of the file', image:'image.jpg url', title:'title of the image', caption:'descripcion of the image', link:"#", }; in some profiles the are many images so the is an array of objects like this [var objeto_img= { name:'name of the file', image:'image.jpg url', title:'title of the image', caption:'descripcion of the image', link:"#", },var objeto_img= { name:'name of the file', image:

Node, Express, Ajax, and Jade Example

我怕爱的太早我们不能终老 提交于 2020-01-01 09:52:57
问题 I'm looking for a simple example of a Node/Express/Jade page being updated using an Ajax call with both the client and server side code. I'm having a bit of trouble putting it all together in my head. 回答1: There are great many ways this could be done and it's not immediately apparent which approach you want to take. I suppose the simplest scenario would be to add some client-side logic to fetch pieces of html from the server and update the client. This is easily achieved using jQuery (put it

Node, Express, Ajax, and Jade Example

瘦欲@ 提交于 2020-01-01 09:51:52
问题 I'm looking for a simple example of a Node/Express/Jade page being updated using an Ajax call with both the client and server side code. I'm having a bit of trouble putting it all together in my head. 回答1: There are great many ways this could be done and it's not immediately apparent which approach you want to take. I suppose the simplest scenario would be to add some client-side logic to fetch pieces of html from the server and update the client. This is easily achieved using jQuery (put it

Gulp using gulp-jade with gulp-data

允我心安 提交于 2020-01-01 07:22:08
问题 I'm trying to use gulp-data with gulp-jade in my workflow but I'm getting an error related to the gulp-data plugin. Here is my gulpfile.js var gulp = require('gulp'), plumber = require('gulp-plumber'), browserSync = require('browser-sync'), jade = require('gulp-jade'), data = require('gulp-data'), path = require('path'), sass = require('gulp-ruby-sass'), prefix = require('gulp-autoprefixer'), concat = require('gulp-concat'), uglify = require('gulp-uglify'), process = require('child_process');

how to have use own jade file for webpack?

和自甴很熟 提交于 2020-01-01 05:52:51
问题 I'm new to webpack and trying to figure out how to use my own html file in the webpack-dev-server, as well as my webpack build. in my app.js I have: require('!jade!index.jade') but that does not make an index.html as I would expect. Instead, it seems at best I can get a string output of my html, which isn't what I want: var jade = require('!jade!index.jade') jade() //outputs my html How do I get it to output an index.html file? How do I get the webpack-dev-server to use that html file? I

how to have use own jade file for webpack?

☆樱花仙子☆ 提交于 2020-01-01 05:52:12
问题 I'm new to webpack and trying to figure out how to use my own html file in the webpack-dev-server, as well as my webpack build. in my app.js I have: require('!jade!index.jade') but that does not make an index.html as I would expect. Instead, it seems at best I can get a string output of my html, which isn't what I want: var jade = require('!jade!index.jade') jade() //outputs my html How do I get it to output an index.html file? How do I get the webpack-dev-server to use that html file? I

jade: if statements and nesting

随声附和 提交于 2020-01-01 01:41:06
问题 Concider this pseudo-ish server side code if(isFixed) { <div class="fixed"> } else { <div> } <p>Inner element</p> </div> I try to do this in jade but... - if(mode === 'fixed') { div#tabbar - } p ...I cannot get this to be an inner element :( It always renders like this, with the </div> closed: <div id="tabbar"></div><p>I want this inside of the div</p> Am I messing up the indention? Thanks! 回答1: You need to separate control flow from the template. Try this: divClass = null if isFixed divClass

Jade/Pug if else condition usage

纵然是瞬间 提交于 2019-12-31 21:22:26
问题 I'm sending a date to a .jade file from my .js file using Node.js . When the #{date} field is false , it executes the else and print man as it's answer. What could be going wrong? if #{date} == false | #{date} else | man 回答1: If date is false, do you want to output the string 'man'? If yes, your if and else statements are the wrong way around... How about: if date = date else | man or even: | #{date ? date : 'man'} or simply: | #{date || 'man'} 回答2: Within if expression you write plain

jade templating syntax support for eclipse?

橙三吉。 提交于 2019-12-31 20:00:26
问题 I have just starting using the nodejs templating engine jade. Unfortunately my IDE eclipse doesn't seem to have support for this syntax and is not highlighting correctly. Is it possible to add support for .jade files to eclipse? 回答1: As current lead of Nodeclipse effort www.nodeclipse.org I announce that Nodeclipse v0.12 has added Minimalist Jade Editor, see http://www.nodeclipse.org/history. Added just before release as I got sick of .jade to be opened outside of Eclipse. #134 - Minimalist

Jquery Autocomplete with Jade/Pug

耗尽温柔 提交于 2019-12-31 05:28:06
问题 i need help for this case, about to implement Jquery Autocomplete in Jade/Pug. The result of autocomplete doesnt display in form, although there are now error shown. Actual : No error, but the data when im typing doesnt display as expected. Expect : The data display in form #combine (automatically) when im typing. I use inline code as "very basic" things. Im sure that there are no error showing in inspect of browser, the script at the right path. Javascript (jqplugins/autocomplete) script(src