extend + append + mixin trouble in jade 0.23 #582

Closed
donpark opened this Issue Apr 11, 2012 · 3 comments

Projects

None yet

4 participants

@donpark
donpark commented Apr 11, 2012

with following setup:

layout.jade:

  !!! 5
  html(lang='en')
    body
      block test
        p foobar

mixins.jade:

  mixin hello
    .hello Hullo!

home.jade:

  extend layout
  include mixins // <--
  append test
    mixin hello

jade 0.23 will throw unknown mixin error.

My best guess is that, in jade 0.23, mixins are not resolved in the context of usage but in context of block being appended to.

If I move the include mixins to layout.jade file like below, error goes away.

layout.jade:

  include mixins // <--
  !!! 5
  html(lang='en')
    body
      block test
        p foobar

mixins.jade:

  mixin hello
    .hello Hullo!

home.jade:

  extend layout
  append test
    mixin hello

I have the same issue. Not sure if this is the intended behavior or not, but it sure is confusing:

extends layout

mixin a_problem
  ol
    li foo
    li bar

block content
  h2 Here is my list
  mixin a_problem

causes

500 ReferenceError: foo.jade:undefined a_problem_mixin is not defined
Contributor
tj commented Apr 29, 2012

it's a little finicky since we're compiling straight to js and dont have a runtime like stylus but this should be fixable. I'll add some tests for this case soon and get it patched up

Contributor
chowey commented May 4, 2012

This should be fixed now with eaa7119.

@tj tj closed this May 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment