Marius Miliunas
Marius Miliunas

Reputation: 1063

jade extend a page generated without a layout

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 // <- won't load

  div#rightPanel
    section#screen
    section#userWindow
      block user // <- won't load

section#chatWindow
  block chat // <- won't load (example case)

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

Upvotes: 0

Views: 783

Answers (1)

zemirco
zemirco

Reputation: 16395

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 // <- won't load (example case)

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!

Upvotes: 2

Related Questions