title: How to uglify all javascript files in subfolders/subdirectory using Grunt?
body: <p>I'm using <a href="http://gruntjs.com/getting-started#package.json" rel="nofollow">Grunt</a> to uglify javascipt files in my project.</p>
  
  <p><strong>Question:</strong></p>
  
  <p>How to uglify all javascript files in subfolders/subdirectory?</p>
  
  <p><strong>What I've done in Gruntfile.js</strong>: </p>
  
  <p>Currently it will only uglify those javascript files in js folder since I'm using src: 'js/*.js'. However I have other directories in js folder that has javascript files:</p>
  
  <pre><code>├── CommonUtil.js
  ├── Paging
  │   ├── dirPagination.js
  │   └── dirPagination.tpl.html
  ├── angular-chart.js
  ├── angular-elastic-input.min.js
  ├── angularAlt.js
  ├── authenticationChallengeHandler
  │   └── loginChallengeHandler.js
  </code></pre>
  
  <p><strong>Gruntfile.js</strong></p>
  
  <pre><code>module.exports = function (grunt) {
      grunt.initConfig({
          // define source files and their destinations
          uglify: {
              files: { 
                  src: 'js/*.js',  // source files mask
                  dest: 'jsm/',    // destination folder
                  expand: true,    // allow dynamic building
                  flatten: true,   // remove all unnecessary nesting
                  ext: '.min.js'   // replace .js to .min.js
              }
          },
          watch: {
              js:  { files: 'js/*.js', tasks: [ 'uglify' ] },
          }
      });
  
  // load plugins
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  
  // register at least this one task
  grunt.registerTask('default', [ 'uglify' ]);
  
  
  };
  </code></pre>