gruntjs - How to uglify all javascript files in subfolders/subdirectory using Grunt? -


i'm using grunt uglify javascipt files in project.

question:

how uglify javascript files in subfolders/subdirectory?

what i've done in gruntfile.js:

currently uglify javascript files in js folder since i'm using src: 'js/*.js'. have other directories in js folder has javascript files:

├── commonutil.js ├── paging │   ├── dirpagination.js │   └── dirpagination.tpl.html ├── angular-chart.js ├── angular-elastic-input.min.js ├── angularalt.js ├── authenticationchallengehandler │   └── loginchallengehandler.js 

gruntfile.js

module.exports = function (grunt) {     grunt.initconfig({         // define source files , destinations         uglify: {             files: {                  src: 'js/*.js',  // source files mask                 dest: 'jsm/',    // destination folder                 expand: true,    // allow dynamic building                 flatten: true,   // remove unnecessary nesting                 ext: '.min.js'   // replace .js .min.js             }         },         watch: {             js:  { files: 'js/*.js', tasks: [ 'uglify' ] },         }     });  // load plugins grunt.loadnpmtasks('grunt-contrib-watch'); grunt.loadnpmtasks('grunt-contrib-uglify');  // register @ least 1 task grunt.registertask('default', [ 'uglify' ]);   }; 

you can use glob patterns like: src: '/**/*.js'


Comments