dalgard / meteor-jade

Improved Jade compiler for Meteor
21 stars 4 forks source link

Cannot read property 'head' of undefined #17

Open mrmowgli opened 8 years ago

mrmowgli commented 8 years ago

When using a jade template in Meteor 1.4+, jade crashes on compile on Jade templates, with an error of Cannot read property 'head' of undefined.

I've tried this with several simple apps, and I managed to reproduce it in the simple-todos app.
I am consistently running into this issue, and I can see no reason why I would get this error.

Steps to reproduce using the meteor simple-todos example:

git clone https://github.com/meteor/simple-todos.git
meteor npm install
meteor update --all-packages
meteor add dalgard:jade
meteor

So far so good. Now lets replace one of the html templates, in this case imports/ui/body.html with body.jade:

body
  .container
    header
      h1 Todo List (#{incompleteCount})

      label.hide-completed
        input(type='checkbox')
          Hide Completed Tasks
      +loginButtons
      if currentUser
        form.new-task
          input(type='text', name='text', placeholder='Type to add new tasks')
    ul
      each tasks
        +task

This results in the error:

packages/compileJade/plugin/handler.js:54:1: Cannot read property 'head' of undefined (compiling imports/ui/body.jade) (at fileModeHandler)
ghost commented 7 years ago

+1

Although you can try .tpl.jade - it will not hunt for head anymore. But in my case it crashed on build :(