Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

jade extend a page generated without a layout

jade extend a page generated without a layout

Problem

My Problem: I cannot get my jade blocks to extend
My Setup: Running the latest NodeJS with Express 3

I'm loading some HTML via Ajax using a Post method

app.post "/utilities", (req, res) ->
  res.render "utilities", layout:false

In Utilities I have the content, and I'm trying to break up everything into chunks so that this page isn't so busy

// utilities.jade

div#topPanel
  section#toolMenu
    block tool // 

And lastly I have the individual blocks that follow this structure

// chat-block.jade
extends utilities

block chat
  div.inner
    div.left
      form#chat-input
        textarea
    div.window
      div.full
Problem courtesy of: Marius Miliunas

Solution

I think what you want to do is to include chunks of jade into your main file.

Change to following code

section#chatWindow
  block chat // 

to

section#chatWindow
  include chat

and your chat-block.jade to

div.inner
  div.left
    form#chat-input
      textarea
    div.window
      div.full

Then it works fine!

Solution courtesy of: zemirco

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

jade extend a page generated without a layout

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×