Refactored to be used in https://github.com/destegabry/angular-requirejs-html5boilerplate-seed