pugjs / then-pug

**EXPERIMENTAL** Async promise based Jade
42 stars 5 forks source link

Unexpected Identifier on `extends ../layout` #1

Closed Industrial closed 10 years ago

Industrial commented 10 years ago

Using sails.js which uses then-jade I have these templates:

views/layout.jade

!!!
html
  head
    meta(name='viewport' content='width=device-width,initial-scale=1,maximum-scale=1')
    title= title
    block styles

  body
    block content
    block scripts
    script(src='/linker/js/socket.io.js')
    script(src='/linker/js/sails.io.js')
    script(src='/linker/js/app.js')

views/user/index.jade

extends ../layout

block content
  h3 Users
  p lulz

if I request the url on the sails/express server that calls res.render() on this views/user/index.jade template, I get an Unexpected Identifier error. It will work if I remove the ../ but that's obviously not what I want :). If I do npm install -g jade; jade views/user/index.jade then it will compile a correct jade file. I'm not sure how to test a (standalone without sails) compilation of a jade file with then-jade.

ForbesLindesay commented 10 years ago

Open the issue in then-jade. This is jade, not then-jade

Industrial commented 10 years ago

not according to npm; https://npmjs.org/package/then-jade

ForbesLindesay commented 10 years ago

My bad, I saw [jade] at the start of the email subject and jumped to the wrong conclusion.

ForbesLindesay commented 10 years ago

This is pretty experimental/unsupported. The way to get somewhere with fixing this would be to update the dependency of then-jade to the latest version of jade, but that requires quite a bit of work.

Industrial commented 10 years ago

I found this to be my offending line; https://github.com/balderdashy/sails/blob/master/lib/configuration/consolidate.js#L177

it being in a catch block and throwing an error itself (both jade and then-jade arent installed in this case) will show the user that then then-jade module isnt available but doesn't say anything about jade which is the default option.

npm install --save jade fixed my problem.

Since then-jade is not release grade yet I have to close this ticket (and wait for when stuff is Done(tm) before bugging people ..)