Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Unknow tag: template #14

Closed
bernatfortet opened this issue Mar 28, 2014 · 4 comments
Closed

Unknow tag: template #14

bernatfortet opened this issue Mar 28, 2014 · 4 comments
Labels

Comments

@bernatfortet
Copy link

I'm getting the following error message:

While building the application: packages/compileJade/plugin/compiler.js:296:
Unknow tag: template on line 5 (compiling test.jade)

Jade FIle

head
    title test
    body asdf

        template(name='hello')
            input(type='button', value='Click')

More Logs

  at _.extend.throwError (packages/compileJade/plugin/compiler.js:296)
  at _.extend.visitTag (packages/compileJade/plugin/compiler.js:131)
  at _.extend.visitNode (packages/compileJade/plugin/compiler.js:89)
  at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
  at _.extend.visitNode (packages/compileJade/plugin/compiler.js:83)
  at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
  at _.extend.visitNode (packages/compileJade/plugin/compiler.js:83)
  at _.extend.visitBlock (packages/compileJade/plugin/compiler.js:73)
  at _.extend.compile (packages/compileJade/plugin/compiler.js:21)
  at sourceHandler (packages/compileJade/plugin/handler.js:11)

Thank!

@mquandalle
Copy link
Owner

You use a wrong indentation. Top levels tags must be head, body and template(name="something"). You can't define a template inside the body (this is the same model as Spacebars).

Here is the working version:

head
    title test

body
    | asdf
    +hello

template(name='hello')
    input(type='button' value='Click')

@bernatfortet
Copy link
Author

Oh! my bad. thanks!

Is there any reason why unknown div names do not compile

@mquandalle
Copy link
Owner

I assume that you meant "tag names" instead of "div names", because jade works with "unknown div names".

Previously Shark was pretty much agnostic to the generated document, because shark internally worked with strings of text. The problem was that in order to reactivively update a single expression somewhere it has to recompute the all template, remove the previous instance from the DOM and re-insert the new computed code. That behavior implied some issues with external libraries independently dealing with the DOM (for instance jquery plugins). The new engine, called Blaze, needs to understand your markup in order to perform fine-grained reactivity updates.

@bernatfortet
Copy link
Author

That make a lot of sense. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants