mquandalle / meteor-jade

The Jade template engine for Meteor/Blaze
http://atmospherejs.com/mquandalle/jade
MIT License
307 stars 39 forks source link

Attributes on body not supported #121

Closed chirvo closed 9 years ago

chirvo commented 9 years ago

Hi there.

First a quick overview:

TL;DR

I'm trying to make this Polymer tutorial along with Meteor: http://www.pubnub.com/blog/creating-a-polymer-chat-app-with-material-design/

The Jade code looks like this:

head
  script(src='bower/webcomponentsjs/webcomponents.min.js')
  link(rel='import', href='bower/core-scaffold/core-scaffold.html')
  link(rel='import', href='bower/core-item/core-item.html')
  link(rel='import', href='bower/paper-input/paper-input.html')
  link(rel='import', href='bower/paper-fab/paper-fab.html')
body(fullbleed, unresolved)
  core-scaffold
    //- Drawer Panel
    core-header(navigation, flex)
      core-toolbar.tall
        //- an avatar and username will be here
    //- App title
    div(tool, layout, horizontal, flex)
      span(flex) Kitteh Anonymous
      core-icon(icon='account-circle')
      //- Number of people online
      span
    //- Main content
    div(flex)
      | ...

However that code breaks the app:

Your app is crashing. Here's the latest log.

Started MongoDB.
Errors prevented startup:

While building the application:
main.jade: Jade syntax error: Attributes on body not supported on line 7
<runJavaScript-40>:60:14: Cannot read property 'head' of undefined (compiling main.jade) (at fileModeHandler)

Your application has errors. Waiting for file change.

Replacing body(fullbleed, unresolved) with just body makes the compiler work again.

Now, when using Jade 1.9.2 from the console I get the proper results without needing to remove the body attributes.

Is there any way to make meteor-jade to fix this like, for example, making meteor-jade use the current jade installation?

Thanks,

nicholas-gates commented 9 years ago

I'm having the same problem and hacked around it using JavaScript:

body script var bodyEl = document.getElementsByTagName("body")[0];bodyEl.setAttribute("unresolved", ""); bodyEl.setAttribute("touch", "auto");

It would be better if this could done in the Jade template.

mquandalle commented 9 years ago

Meteor/Spacebars added body attributes support in the latest 1.0.4 — see https://github.com/meteor/meteor/issues/2561. I'll update meteor-jade to support this as well.

chirvo commented 9 years ago

Nice. Thanks Maxime! :)

mquandalle commented 9 years ago

This is fixed in v0.4.3.