Derbyjs TEMPLATE ERROR

189 Views Asked by At

I just started trying out Derbyjs, and I already ran into a problem. I can't find any support for this error, and most likely is some dumb mistake i'm making.

I'm trying to render a view, following the example from the www.derbyjs.com documentation.

My app is as simple as this:

var app = require('derby').createApp(module);
app.get('/', function (page, model) {
    page.render('home');
 });

My views are composed by two files.

"index.html"

<import: src="home">
<Body:>
  Default page content

"home.html"

<Body:>
  Welcome to the home page

I get the following error whenever the page is rendered:


TEMPLATE ERROR

Error: Template import of 'home'... ...can't contain content


As you can see, it is a very simple example. What am I missing? I get that error even if I have the "home.html" file empty.

1

There are 1 best solutions below

0
On BEST ANSWER

Well, I got the answer from one of the developers.

It seems like there was a subtle bug in the Template Parser that probably has already been fixed.

Having a whitespace or linebreak in front of

<import: src="home">

was causing the parser to raise the error. Writing

<import: src="home"><Body:>

solved the issue.