pug

How to use folders in views with express app

大城市里の小女人 提交于 2019-12-12 01:14:20
问题 I have a pug template inside my views folder under views/administration/assets/fixed-assets.pug My default.pug which the fixed-assets.pug extends from is in my root views folder. When I try to render the fixed-assets.pug view it looks for the default.pug inside the views/administration/assets/ directory rather than the views directory itself Everything works fine if I take the fixed-assets.pug and place it in the views directory instead of the views/administration/assets/ directory and update

How to load multiple JSON files into Jade templates using Grunt?

荒凉一梦 提交于 2019-12-12 01:09:35
问题 I can successfully load one JSON file as a data source for my Jade templates using Grunt, similar to this solution. Now I need to load a set of JSON files from different folders inside my project so that all the data from them is accessible from Jade templates. How to do it better in context of Grunt tasks? 回答1: You can load as many json files as you like with this method: // Jade => HTML gruntConfig.jade = { compile: { options: { data: { object: grunt.file.readJSON('JSON_FILE.json'), object1

Using Onsen, how to write server side code in NodeJs that will render Jade files as HTML in a splitter

家住魔仙堡 提交于 2019-12-12 00:48:42
问题 In my Onsen app I have the following splitter. I am using Jade, and rendering all the other pages from the list items in html (despite the fact that they are in separate jade files) by including the files at the bottom of the page, as shown below: body(ng-controller='...') ons-splitter(var='mySplitter') ons-splitter-side(var='menu' side='left' width='220px' collapse swipeable) ons-page ons-list ons-list-item(ng-click="root.load('home.jade')", tappable='') | Home ons-list-item(ng-click="root

Jade template does not seem to be getting data from Express

一个人想着一个人 提交于 2019-12-11 23:55:25
问题 In the get handler, I create an object, plans , from my data source. Then I do: console.log(plans); res.render('dashboard', plans); It prints: { '0': 'mobile_basic', '1': 'mobile_basic', '2': 'landline_basic', '3': 'landline_mid', '4': 'internet_mid' } This means that this object is being passed into the template. In the dashboard Jade template, I have: if plans ul each val, index in plans li= index + ': ' + val This never shows up. plans is undefined in the template's context. What am I

Jade to HTML > index.html inside directory named after jade file

眉间皱痕 提交于 2019-12-11 22:53:26
问题 I've got a simple gulp task that compiles a .jade file to an .html file: var gulp = require('gulp'), jade = require('gulp-jade'); gulp.task('jade', function() { return gulp.src('src/templates/**/*.jade') .pipe(jade()) // pip to jade plugin .pipe(gulp.dest('public')); // tell gulp our output folder }); Issue /src/templates/page.jade is compiled to HTML at the destination /public/page.html How would I get it so it would compile /src/templates/page.jade to /public/page/index.html . I.e. every

AngularJS: app not getting data from get request

烂漫一生 提交于 2019-12-11 22:36:01
问题 My Angular app has the following code: index.jade: doctype 5 html head body(ng-app='app') div(ng-controller='EventController') div(ng-repeat='event in events') h2 {{event.name}} h3 {{event.location}} h2 Create new event label(for='name') Name: input(ng-model='event.name') label(for='location') Location: input(ng-model='event.location') button(ng-click='create(event)') Submit script(src='https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.js') script(src='https://ajax.googleapis.com

Pug/Jade and inline javascript calculations

倾然丶 夕夏残阳落幕 提交于 2019-12-11 18:47:47
问题 I'm lost, again, trying to do some simple calculations in jade template. Given this data object: { "trade": { "name": "Mogens", "dst_currency": "EUR", "dst_value": 115.7, "src_price": null, "src_value": 2, "src_currency": "XMR", "date": null } } And this pug source: table thead tr th Currency th Quantity th Price th Total th Date tbody tr script. if (trade.dst_currency === "EUR") trade.src_price = trade.dst_value / trade.src_value else trade.src_price = Number(trade.src_value) / Number(trade

nodejs, express and jade: problems with inserts from form to database

被刻印的时光 ゝ 提交于 2019-12-11 18:13:57
问题 when i try to enter data in my jade form i get error message that says it is null. Can someone help me figuring out what the problem is? app.js var express = require('express'); var pg = require('pg'); var routes = require('./routes'); var user = require('./routes/user'); var http = require('http'); var path = require('path'); var app = express(); var conString = "postgres://abc:123@localhost/abc"; app.set('port', process.env.PORT || 3000); app.set('views', path.join(__dirname, 'views')); app

Recordset.EOF and Recordset.next (ADO) equivalent on Express/Pug

陌路散爱 提交于 2019-12-11 17:22:16
问题 Good afternoon, I can't find any way to move cross recordset (as I did in ADO). Below It's an example for what I have done in .pug, with error: " items is undefined on line 1 " server.js //... res.render('ItemsList.pug', { items: row }, function(err, html) { res.status(200).send(html) }); ItemsList.pug - for (var i = 0; items.length; i++) { p div div(id='items' + items[i].rowid) div img(src='img/'+ items[i].tapa) br/ items[i].titulo br/ items[i].titulo_alt img(class='right' src='img/'+ items

jade template tag bracket percentage definition

被刻印的时光 ゝ 提交于 2019-12-11 17:07:40
问题 I was reading the following jade code in drywall signup page and not sure about what the appearances of <% <%= means ? Can any one tell me ? script(type='text/template', id='tmpl-signup') form div.alerts |<% _.each(errors, function(err) { %> div.alert.alert-danger.alert-dismissable button.close(type='button', data-dismiss='alert') × |<%= err %> |<% }); %> div.form-group(class!='<%= errfor.username ? "has-error" : "" %>') label.control-label Pick a Username: input.form-control(type='text',