twitter / hogan.js

A compiler for the Mustache templating language
http://twitter.github.io/hogan.js
Apache License 2.0
5.14k stars 431 forks source link

[Bug|Feature request] Throw on undefined partial #208

Closed lennym closed 3 years ago

lennym commented 9 years ago

If I reference an undefined partial template then an empty string is output in its place. It would be nice as a developer to have some kind of warning/output/error thrown if I try to reference a partial that does not exist.

At the least, a console.warn could alert me to my mistake, but ideally throw an error, although I understand that this might need to sit behind some kind of "strict mode" flag to avoid being a breaking change.

Happy to PR either if requested.

sayrer commented 9 years ago

Will take a PR if it doesn't bloat production filesize.

lennym commented 9 years ago

A simple console.* or throw will be a one-liner at https://github.com/twitter/hogan.js/blob/master/lib/template.js#L67 or https://github.com/twitter/hogan.js/blob/master/lib/template.js#L93, having an option will probably be slightly more, but I will have a look at it today to see how it comes in.