looping looping -4 years ago 235
Javascript Question

how to config grunt.js to minify files separately

there are some js files in static/js/

1. a.js
2. b.js
3. c.js

how to config grunt.js to get below files:

1. a.min.js
2. b.min.js
3. c.min.js

as far, I have to type specific file name:

min: {
dist: {
src: 'js/**/*.js',
dest: 'js/min/xxx.min.js'

Answer Source

Had the same problem and found a solution that would automatically minify all my scripts separately:

uglify: {
      build: {
        files: [{
            expand: true,
            src: '**/*.js',
            dest: 'build/scripts',
            cwd: 'app/scripts'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download