pyjade icon indicating copy to clipboard operation
pyjade copied to clipboard

Variables defined in extended template are not visible to base template

Open blx opened this issue 9 years ago • 1 comments

Given these two templates (inspiration)

//- base.jade
block vars
h1= message

//- sub.jade
extends ./base.jade
block vars
    - var message = "It works!"

jade sub.jade produces

<h1>It works!</h1>

but with pyjade the variable doesn't seem to be visible to base.jade. I've tried django and jinja compiler targets, and just get <h1></h1>.

Jinja test is here: gist.

Is this intentional for pyjade, and does anyone have any alternative ideas? Thanks!

EDIT: I'm going to look into this more, it's likely django's fault.


Intended use case

Many pages extend from base.jade, which defines the <head>, etc. Each subpage has a different title, for example, but these are constant "variables" that shouldn't need to be passed in from django if they could just be defined in the subpage templates themselves.

blx avatar Aug 15 '15 10:08 blx

I have the same problem

deshaser avatar Sep 10 '16 13:09 deshaser