deprecatedが出ていたngminからng-annotateへ切り替え
AngularJSのminify対策をしてくれるアレ。
例によって、generator-angularで作ったプロジェクトでの話。
grunt-ng-annotateをインストールしてgrunt-ngminを外して、記述をngminからngAnnotateにしただけでいけました。
% npm install grunt-ng-annotate -D
diff --git a/package.json b/package.json index 77190a9..e1f2b1a 100644 --- a/ngapp/package.json +++ b/ngapp/package.json @@ -25,7 +25,7 @@ "grunt-google-cdn": "^0.4.0", "grunt-karma": "^0.8.3", "grunt-newer": "^0.7.0", - "grunt-ngmin": "^0.0.3", + "grunt-ng-annotate": "^0.3.2", "grunt-protractor-runner": "^1.1.0", "grunt-svgmin": "^0.4.0", "grunt-usemin": "^2.1.1",
-- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -300,10 +300,7 @@ module.exports = (grunt) -> dest: "<%= yeoman.dist %>" ] - # ngmin tries to make the code safe for minification automatically by - # using the Angular long form for dependency injection. It doesn't work on - # things like resolve or inject so those have to be done manually. - ngmin: + ngAnnotate: dist: files: [ expand: true @@ -443,7 +440,7 @@ module.exports = (grunt) -> "concurrent:dist" "autoprefixer" "concat" - "ngmin" + "ngAnnotate" "copy:dist" "cdnify" "cssmin"