A. Duff
A. Duff

Reputation: 4309

How to minify AngularAMD code?

I've been looking at the AngularAMD library and I'm wondering if there's a way to minify the code for use in production.

I've taken a look at the AngularAMD sample which does have a Grunt configuration, but unfortunately, the instructions for building aren't working for me, and it's giving an error on the grunt setup step. So I'm not able to see whether this project is producing the sort of minimized code that I'm looking for.

When trying to use grunt-contrib-concat on the example AngularAMD code, the problems I run into are the same ones that you traditionally run into when trying to minimize Angular projects with RequireJS which led to Ravi Kiran's blog post on how to integrate the two.

(e.g. defining both app which creates the initial Angular module, and its controllers as RequireJS modules ends up with a circular dependency, so that you need to define the controllers as individual functions, list those functions as dependencies in the code which creates the Angular module, and then call angular.module(...).controller on each of them.)

Upvotes: 0

Views: 237

Answers (1)

marcoseu
marcoseu

Reputation: 3952

The problem with angularAMD-sample project during grunt setup resulting in cryptic Fatal error: Arguments to path.join must be strings was actually caused by an older version of grunt-bower-task. Updating it to 0.4.0 from 0.3.2 resolved the problem.

grunt deploy should now produce the minified code with angularAMD.

Upvotes: 1

Related Questions