title: load grunt task from another gruntfile
body: <p>I want to avoid duplicate code, so i am trying to load grunt task from Grunt file "a" and use them in gruntfile "b". </p>
  
  <p>that means: i want to see all task of "a" in file "b" (but without code), just setup like a reference or template to another gruntfile. </p>
  
  <p>here is grunt file "b":</p>
  
  <pre><code>module.exports = function (grunt) {
  'use strict';
  
  var karmaGrunt = './../../grunt',
      abortHandler = function () {
          var errors = grunt.fail.errorcount,
              warnings = grunt.fail.warncount;
  
          if (errors &gt; 0 || warnings &gt; 0) {
              //run rocketlauncher python script and then stop the grunt runner.
              grunt.task.run(["shell:rocketlauncher", "fatal"]);
          }
      },
      fatal = function () {
          // this function stops grunt and make the jenkins build red.
          grunt.fail.fatal('failed');
      };
  
  require("grunt-load-gruntfile")(grunt);
  
  // load grunt task from another file and add it.
  grunt.loadGruntfile(karmaGrunt);
  
  //grunt needs to continue on error or warnings, that's why we have to set the force property true
  grunt.option('force', true);
  
  grunt.initConfig({
      shell: {
          options: {
              execOptions: {
                  cwd: '../scripts'
              }
          },
          'rocketlauncher': {
              command: './runRocketLauncher.sh'
          }
      }
  });
  
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-shell');
  
  grunt.registerTask('build-process', ['karma', 'abortHandler']);
  grunt.registerTask('abortHandler', abortHandler);
  grunt.registerTask('fatal', fatal);
  }
  </code></pre>
  
  <p>here is file "a":</p>
  
  <pre><code>module.exports = function (grunt) {
  "use strict";
  var eConfig = '../e-specs/karma.config.js',
      dConfig = '../d-specs/karma.config.js',
      cConfig = '../c-specs/karma.config.js';
  grunt.initConfig({
      karma: {
          options: {
              reporters: ['progress', 'coverage', 'threshold']
          },
          c: {
              configFile: cConfig
          },
          d: {
              configFile: dConfig
          },
          e: {
              configFile: eConfig
          }
      }
  });
  
  grunt.loadNpmTasks('grunt-karma');
  };
  </code></pre>
  
  <p>my file b load the task "Karma" but if i run only the grunt file of a i have 3 nested task ("e","c","d") but if i load them from another file, the only task i can see is "karma"</p>
  
  <p>the error is: </p>
  
  <blockquote>
    <blockquote>
      <p>No "karma" targets found.
      Warning: Task "karma" failed. Used --force, continuing.</p>
    </blockquote>
  </blockquote>
  
  <p>Done, but with warnings.</p>
  
  <p>If i run the same task in file "a" directly the task is working like a charm.</p>