pug

jade templating syntax support for eclipse?

邮差的信 提交于 2019-12-03 03:05:20
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? 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 Jade Editor idea is to define HTML tags and JavaScript keywords as words for highlight in Word.java and then

jade template engine (under node.js): multi-line block without pipe symbol

╄→尐↘猪︶ㄣ 提交于 2019-12-03 02:56:40
I'm currently using Jade on a new project. It seems well-suited to composing webapp layouts, but not for writing static content, such as a web page of elements containing text. For example, to create such a paragraph, I believe I need to do this: p | This is my long, | multi-line | paragraph. For a static web page full of real paragraphs of text, using jade becomes a burden due to that pipe symbol at the beginning of each line. Is there some sort of syntactic sugar for marking the whole block as a text node, as the pipe symbol does on a line-by-line basis? Or an existing filter I'm unaware of?

How do I pass content from a template to a layout in Express?

随声附和 提交于 2019-12-03 02:51:54
问题 I have a basic Express server: // server.js: var Express = require('express'); app = Express.createServer(); app.configure(function(){ app.set('views', Path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.set('view options'); }); app.get('/', function (request, response) { response.render('welcome', { locals: {some: 'Locals'} }); }); With a basic jade layout: // views/layout.jade: !!! 5 html(lang='en') head title= pageTitle body h1= pageTitle aside(id="sidebar")= sidebarContent

PHP vs Node.js - Is HTML Rendering slower in Node.js with Jade?

寵の児 提交于 2019-12-03 02:51:11
Assuming that we have millions of requests per day. Is the HTML processing in Node.js with Jade slower or faster than PHP's render engine? Or doesn't matter because the difference is really small? I'm using Node.js with the Jade template engine , I really like it. But I was always the guy who worried about performance. I started my developer career with PHP, it was fun but now Node seems much much better, so I decided to switch. I use Jade to Render HTML, because node.js alone lacks it(I know this sounds a bit stupid because Jade is node too :P). But because Jade is a module in Node I'm a bit

jade template engine, how to use layout.jade?

℡╲_俬逩灬. 提交于 2019-12-03 02:49:41
问题 I have a website in node.js; to create a page, say mypage I noticed I need to create both a layout.jade and mypage.jade files. If I put code in mypage.jade it is not displayed, so first I have to fill layout.jade with the layout of the page. My question is, how do I reference inside layout.jade that I would like to load the content of mypage.jade in a certain container, for example? Can I have different pages with the same layout? How can I do this? Thanks 回答1: http://expressjs.com/guide.html

Jade/Pug if else condition usage

不打扰是莪最后的温柔 提交于 2019-12-03 01:44:13
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 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'} Within if expression you write plain variable names, without #{...} if date == false | #{date} else | man Your statement was backwards. For the syntax, You

Access current request in Express/Jade view

左心房为你撑大大i 提交于 2019-12-02 22:36:52
I have a layout Jade view that has a menu via unordered list, and I want to set the <li> to be <li class="active">...</li> when the current page is rendered in the browser. I assume I will have to access the current request to determine when to set the attribute on the <li> I can't find any examples of how to do this so hoping someone can help Thanks Try this before your call res.render() in your route: res.locals.path = req.path; res.render('/page'); or res.render('/page', { path: req.path }); Then you would have to do a bunch of if/else statements in your view (as the above solution suggests

Jade template layouts not working in combination with Node.js

拟墨画扇 提交于 2019-12-02 20:45:14
I'm trying to create a simple server in Node.js which uses Jade templates and layouts. For some reason it will only load the template and not the layout. Here's what I've got: main.js var express = require('express'); var app = express.createServer(); app.set('views', __dirname + '/views'); app.set('view engine','jade'); app.set('view options', { layout: true }); app.get('/', function(req,res) { res.render('index', { title: 'My site' }); }); app.listen(4000); As you can see layouts are enabled. I've tried referencing it directly in the render method but it doesn't make a difference. Worth

Passing raw Markdown text to Jade

元气小坏坏 提交于 2019-12-02 20:22:20
I'm playing around with my first Node.js Express application, and as every programmer knows, the first thing you should build when testing out a new framework is a blog! Anyway, I'd like to write the articles in Markdown and then render it in the view. I saw that Jade allows for this to be done inside the view itself, using filters, but I can't get that working. To simplify the situation, here's an example of what I'm talking about. //app.js res.render("article", { md : "Hello World!\n\n*Woo*" }); //article.jade section :markdown #{md} But, that outputs this: <section><h1>{md}</h1></section> .

Static HTML compilation with partials using Grunt.js [closed]

主宰稳场 提交于 2019-12-02 19:13:04
I've been looking all over for something that will let me precompile static websites using Grunt. It needs to have partials, so I can include things like a common header/footer across the pages. So far, I've only really found Jade , which has a grunt plugin, and this plugin for Grunt that compiles Dust.js templates to static HTML. I don't really like Jade's syntax, and the Dust plugin for Grunt is less than ideal. Are there any static HTML templating languages with Grunt/Gulp support that don't deviate too much from regular HTML, and are still active? I found this plugin named grunt-includes .