You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 26, 2018. It is now read-only.
Remove the minsafe templates, documentation and options from the
generator.
Closes#452
BREAKING CHANGE: Removes the --minsafe from the generator. See the
readme for more information about this change
Copy file name to clipboardExpand all lines: readme.md
+4-35Lines changed: 4 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,45 +193,14 @@ To output JavaScript files, even if CoffeeScript files exist (the default is to
193
193
194
194
### Minification Safe
195
195
196
-
**Deprecated**
196
+
**Removed**
197
197
198
-
[Related Issue #452](https://github.com/yeoman/generator-angular/issues/452): This option is being removed in future versions of the generator. Initially it was needed as ngMin was not entirely stable. As it has matured, the need to keep separate versions of the script templates has led to extra complexity and maintenance of the generator. By removing these extra burdens, new features and bug fixes should be easier to implement. If you are dependent on this option, please take a look at ngMin and seriously consider implementing it in your own code. It will help reduce the amount of typing you have to do (and look through) as well as make your code cleaner to look at.
198
+
[Related Issue #452](https://github.com/yeoman/generator-angular/issues/452): This option has been removed from the generator. Initially it was needed as ngMin was not entirely stable. As it has matured, the need to keep separate versions of the script templates has led to extra complexity and maintenance of the generator. By removing these extra burdens, new features and bug fixes should be easier to implement. If you are dependent on this option, please take a look at ngMin and seriously consider implementing it in your own code. It will help reduce the amount of typing you have to do (and look through) as well as make your code cleaner to look at.
199
199
200
-
201
-
By default, generators produce unannotated code. Without annotations, AngularJS's DI system will break when minified. Typically, these annotations that make minification safe are added automatically at build-time, after application files are concatenated, but before they are minified. By providing the `--minsafe` option, the code generated will out-of-the-box be ready for minification. The trade-off is between amount of boilerplate, and build process complexity.
202
-
203
-
#### Example
204
-
```bash
205
-
yo angular:controller user --minsafe
206
-
```
207
-
208
-
Produces `app/controller/user.js`:
209
-
```javascript
210
-
angular.module('myMod').controller('UserCtrl', ['$scope', function ($scope) {
211
-
// ...
212
-
}]);
213
-
```
214
-
215
-
#### Background
216
-
Unannotated:
217
-
```javascript
218
-
angular.module('myMod').controller('MyCtrl', function ($scope, $http, myService) {
219
-
// ...
220
-
});
221
-
```
222
-
223
-
Annotated:
224
-
```javascript
225
-
angular.module('myMod').controller('MyCtrl',
226
-
['$scope', '$http', 'myService', function ($scope, $http, myService) {
227
-
228
-
// ...
229
-
}]);
230
-
```
231
-
232
-
The annotations are important because minified code will rename variables, making it impossible for AngularJS to infer module names based solely on function parameters.
200
+
By default, generators produce unannotated code. Without annotations, AngularJS's DI system will break when minified. Typically, these annotations that make minification safe are added automatically at build-time, after application files are concatenated, but before they are minified. The annotations are important because minified code will rename variables, making it impossible for AngularJS to infer module names based solely on function parameters.
233
201
234
202
The recommended build process uses `ngmin`, a tool that automatically adds these annotations. However, if you'd rather not use `ngmin`, you have to add these annotations manually yourself. **One thing to note is that `ngmin` does not produce minsafe code for things that are not main level elements like controller, services, providers, etc.:
0 commit comments