Task Automation

Use Gulp or Grunt for creating automated tasks. Gulp leans to code over configuration while Grunt leans to configuration over code. I personally prefer Gulp as I feel it is easier to read and write, but both are excellent.

[Style Y400]
  • Use task automation to list module definition files *.module.js before all other application JavaScript files.

    Why?: Angular needs the module definitions to be registered before they are used.

    Why?: Naming modules with a specific pattern such as *.module.js makes it easy to grab them with a glob and list them first.

    var clientApp = './src/client/app/';
    
    
    // Always grab module files first
    var files = [
      clientApp + '**/*.module.js',
      clientApp + '**/*.js'
    ];