antiboredom / servi.js

36 stars 6 forks source link

Non-existent variable in template causes fatal error #12

Open robynitp opened 9 years ago

robynitp commented 9 years ago

When my template contains a variable that doesn't exist in the data object, a fatal error is thrown, causing the script to shut down. Is that intentional? I wonder if there's a way to make it more forgiving.

For example, if my data object is:

var data = {
     title: "Hello",
     content: "Your article text here"
}

... and my HTML template contains something like:

<h1><%= title %></h1>
<p><%= author %></p>
<p><%= content %></p>

... then the server shuts down.