Added test for dynamic includes
Updated dynamic includes resolution to read better.

Replaced path with templatePath as that is more semmantic and
lifted the templatePath definition out of the if statement so as to
prvent future jshint errors.