title: Grunt conditional option
body: <p>I'm attempting to create a Jade task that will have a build and dev task that have very similar options, except a dev boolean, and a different destination. The simplest way I've been able to achieve this is:</p>
  
  <pre><code>jade: {
      dev: {
          options: {
              data: {
                  dev: true, // dev true
                  config: ...,
                  pkg: ...,
                  helpers: ...
              }
          },
          files: [{
              dest: '&lt;%= config.workingDir %&gt;',
              ...
          }]
      },
      build: {
          options: {
              data: {  // no dev
                  config: ...,
                  pkg: ...,
                  helpers: ...
              }
          },
          files: [{
              dest: '&lt;%= config.buildDir %&gt;',
              ...
          }]
      }
  }
  </code></pre>
  
  <p>There's considerable repetition in this though, particularly if I want to add more options down the track. So I'm trying to create one build task that will work both from command line and from a watch task.</p>
  
  <p>The closest I've gotten is this setup, where I can run <code>grunt jade --dev</code> from the command line but can't set the dev boolean in the watch task.</p>
  
  <pre><code>build: {
      options: {
          data: {
              dev: '&lt;%= grunt.option("dev") %&gt;',
              config: ...,
              pkg: ...,
              helpers: ...
          }
      },
      files: [{
          dest: '&lt;%= grunt.option("dev") ? config.workingDir : config.buildDir %&gt;',
          ...
      }]
  }
  </code></pre>
  
  <p>The watch task:</p>
  
  <pre><code>watch: {
      jade: {
          ...
          tasks: ['jade'] // the option is false
      }
  }
  </code></pre>
  
  <p>I've also attempted to create a custom task that sets the option and then runs watch, which when listening to the watch event I can see the option is correctly set</p>
  
  <pre><code>grunt.registerTask('dev', 'Grunt dev mode', function(){
      grunt.option('dev', true);
      grunt.task.run('watch');
  });
  
  grunt.event.on('watch', function(action, filepath, target) {
      console.log(grunt.option('dev')); // true
  });
  </code></pre>
  
  <p>Even though the log shows the dev boolean as true the wrong task options are being passed. So, with all that said, am I going about setting options the right way or am I just stuck with having a build and dev task that repeat the same information?</p>
  
  <p>I've also tried using the grunt.util._.expand method with little success.
  <code>data: "&lt;%= grunt.util._.extend(jade.options.data, {dev: true}) %&gt;",</code></p>