R
R
Rodion Meshcheryakov2014-06-03 16:16:28
Pug
Rodion Meshcheryakov, 2014-06-03 16:16:28

How to properly modify a piece of template in Jade?

There is template.jade

doctype html
html
  head
    meta(charset='utf-8')
    meta(http-equiv='X-UA-Compatible', content='IE=edge')
    block pageTitle
    title TEMPLATE | #{pageTitle}
    meta(name='description', content='')
    meta(name='viewport', content='width=device-width, initial-scale=1')
    link(rel='stylesheet', href='../css/main.css')
    //[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]
  block body
    block bottom-script
      script(src='../js/plugins.js')
      script(src='../js/main.js')

There is a page template:
extend _template
block pageTitle
  - var pageTitle = 'Sample Page'
block prepend body
  body
    include parts/_header
    main.page-content.sample-page
      ... content ...

There is a header template _header.jade:
header.main-header
  ... content ...

The header on different pages can be of different heights: normal and narrow (determined by the presence of .slim for the header)
Question: how can I include _header.jade with the .slim class on certain pages? Or how should the structure be redone if it is wrong from Jade's point of view?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Velichko, 2014-06-03
@Zoxon

just include another header
include parts/_header-slim on the necessary pages

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question