pug

Grunt jade compiler filling out empty attributes

纵然是瞬间 提交于 2019-12-07 20:16:01
问题 I'm using the grunt-contrib-jade module to compile my Jade templates, if I leave my attribute blank like the following line: article(ui-view) It will compile to: <article ui-view="ui-view"></article> And that will break my AngularJS ui-router, as it will not handle the "ui-view" directive as if it is a named view (not what I want). Of course it's an option to write my jade file like this: article(ui-view='') But that's not what I want, is there some way to stop the jade compiler from filling

Error installing jade on heroku

∥☆過路亽.° 提交于 2019-12-07 18:02:59
问题 I get an error when pushing my node.js-app to Heroku. It used to work, but now, for some reason, it's failing. When I push to Heroku I get the following: -----> Node.js app detected -----> Resolving engine versions Using Node.js version: 0.6.13 Using npm version: 1.1.4 -----> Fetching Node.js binaries -----> Vendoring node into slug -----> Installing dependencies with npm npm http GET https://registry.npmjs.org/express/2.5.9 npm http GET https://registry.npmjs.org/jade/0.15.4 npm http 200

Status code 304 (Jade, Node, Express)

蓝咒 提交于 2019-12-07 17:24:59
问题 I'm linking bootstrap and jquery in my jade file, link(rel='stylesheet', href='/stylesheets/bootstrap.css') and script(src='/javascripts/jquery-3.1.1.js') script(src='/javascripts/bootstrap.js') This Jade file is in my views folder. The boostrap css is in my public/stylesheets folder and the javascript is in the public/javascripts folder. When I run my application using nodemon, it says GET / 200 80ms - 1.65kb GET /stylesheets/bootstrap.css 304 1ms GET /javascripts/jquery-3.1.1.js 304 3 GET

How to define jade template for using with Backbone

家住魔仙堡 提交于 2019-12-07 16:21:15
问题 I need to use template for rendering of each ItemView: var ItemView = Backbone.View.extend({ className: 'item', template: _.template($('#itemTemplate').html()), initialize: function () { } }); So I need to define html template at first: <script id="itemTemplate" type="text/template"> <img src="<%= photo %>" alt="<%= name %>" /> <h1><%= name %><span><%= type %></span></h1> <div><%= address %></div> <dl> <dt>Tel:</dt><dd><%= tel %></dd> <dt>Email:</dt><dd><a href="mailto:<%= email %>"><%= email

Express displaying mongodb documents in Jade

冷暖自知 提交于 2019-12-07 15:53:54
问题 I'm learning Node, Express, Jade & Mongodb. I'm unable to display my mongodb documents in jade. I'm unable to figure it out on my own. I'm successfully logging all documents using console.log and it display all the documents correctly. Please no mongoose or other solutions. Just how to build on this code. I already connected to the db, displayed all documents in terminal. How to be able to pass it to Jade and display it in view.jade? Thanks. Here is my app.js code var express = require(

Passing data from node to jade?

前提是你 提交于 2019-12-07 12:58:24
问题 The problem is I render a view and send some data console.log(products); // shows an array res.render('seller/sell',{'shop_id':req.user.shop_id ,'products':products}); and I save the data like this in jade input(id='shop_id',type='hidden',name='shop_id',value='#{shop_id}') input(id='pd',type='hidden',name='pd',value='#{products}') if(products !='') each val , key in products a(href!='home/sell/edit?id=#{val.id} ',class='product') img(class='product_thum',src!='#{ val.product_thum}',alt!='#{

Nested jade via conditional logic

喜夏-厌秋 提交于 2019-12-07 12:22:39
问题 I've got a result set of json data that is retrieved that is called data_list. I want to iterate through it and pull out its name field and embed it it in a twitter bootstrap grid metaphor. The output of this would look something like the following: <div class="row"> <div class="span4">Name 1</div> <div class="span4">Name 2</div> <div class="span4">Name 3</div> </div> <div class="row"> <div class="span4">Name 4</div> <div class="span4">Name 5</div> <div class="span4">Name 6</div> </div> The

Compile client-side Jade templates using Gulpjs

别来无恙 提交于 2019-12-07 09:40:07
问题 I'm trying to compile all my .jade templates into a single js file, I'm using Gulpjs and gulp-jade, gulp-concat.. I can get the single file but the problem is that all the functions rendered there have the same name, they are all called "template". foo.jade: .fooDiv h1 Foo here foo2.jade: .foo2Div h1 Foo2 here Gulp file: gulp.src("templates/**/*.jade") .pipe(jade({client: true})) .pipe(concat("templates.js")) .pipe(gulp.dest("../website/templates")) That would output a file like this:

Render array of objects in Jade / Pug

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-07 06:50:09
问题 I don't find a lot of stuff for Pug / Jade templating, so I try here. I've been reading the documentation for iterations and also this link here. I'm working with Node.js, Express, and pug. So far I have some function server side that collect some data about users (I'm building a fake dating website as a school project) So my code server side looks like this : router.post('/matchaSearch', function (req, res) { matchaSearch(pool, session.uniqueID) .then((results) => { res.results = JSON

What does != do in jade/pug?

 ̄綄美尐妖づ 提交于 2019-12-07 06:47:35
问题 How does != work in jade code below.. != messages() extends layout block content .spacer .container .row .col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1 a(class='btn btn-tiny btn-primary' href='/manage/categories/add') Create Category h1= title small a(href='/manage/articles') Manage Articles != messages() table(class='table table-striped') tr th Category Title th each category, i in categories tr td #{category.title} td a(class="btn btn-tiny btn-default" href="/manage/categories/edit/#