title: How to pass external JSON data to the task from file that generating in previous task?
body: <p>I'm stuck here with this one.
  I've got gruntfile with this type of tasks:</p>
  
  <pre><code>grunt.initConfig({
  
    shell: {
      // stub task; do not really generate anything, just copy to test
      copyJSON: {
        command: 'mkdir .tmp &amp;&amp; cp stub.json .tmp/javascripts.json'
      }
    },
  
    uglify: {
      build: {
        files: {
          'output.min.js': grunt.file.readJSON('.tmp/javascripts.json')
        }
      }
    },
  
    clean: {
      temp: {
        src: '.tmp'
      }
    }
  });
  
  grunt.registerTask('build', [
    'shell:copyJSON',
    'uglify:build',
    'clean:temp'
  ]);
  </code></pre>
  
  <p>And, of cource, this is don’t work, because there is no <code>.tmp/javascripts.json</code> file:</p>
  
  <pre><code>Error: Unable to read ".tmp/javascripts.json" file (Error code: ENOENT). 
  </code></pre>
  
  <p>I’ve try to do extra task what creating the variable after file is generated, tried to store it at <code>globals.javascript</code> and <code>grunt.option("JSON")</code>, like this: </p>
  
  <pre><code>grunt.registerTask('exportJSON', function() {
      if (grunt.file.exists('.tmp/javascripts.json')) {
          grunt.log.ok("JSON with set of javascripts exist");
          grunt.option("JSON", grunt.file.readJSON('.tmp/javascripts.json'));
      }
      else {
          grunt.fail.warn("JSON with set of javascripts does not exist");
      };
  });
  
  grunt.initConfig({
      uglify: {
          build: {
              files: {
                  'output.min.js': grunt.option("JSON")
              }
          }
      }
  });
  
  grunt.registerTask('build', [
      'shell:copyJSON',
      'exportJSON',
      'uglify:build',
      'clean:temp'
  ]);
  </code></pre>
  
  <p>And always have a same error <code>Warning: Cannot call method 'indexOf' of undefined Use --force to continue.</code></p>
  
  <p>Do not really know how to figure this out. Any ideas?</p>