Include js dependencies in the template and cover MainTemplate with unit tests

I'm already using `require` which will scream if there won't be the file, or it won't be readable. But what we really have to do is to register our custom error handler.

Added DS constant.