Problem: All the dependency injections in the project I am working on currently do not support JavaScript minification. Minification is the process of removing all the white space and other unnecessary characters from the code, such as comments, new line characters and sometimes block delimiters. This compresses the code without removing any functionality, and because it isn't actually compressed it doesn't need to be uncompressed to be read (therefore both the minified source and the original can be interpreted immediately). - source
I am using Grunt to minify all code, which uses UglifyJS to minify the JavaScript specifically.
Solution: By adding a simple object (keyword) to map the parameter instead of injecting directly into the function. This means that if parameters naming changes it will still be injecting the correct value.
Current code:
Improved code:
All the controllers, directives and factories should be in this format.
No comments:
Post a Comment