Search code examples
javascriptgruntjsyui-compressorminifyuglifyjs

Grunt.js - uglify / yui compressor - one to one file mapping


I know I can uglify multiple files into one like this:

uglify: {
    dist: {
        files: {
            'Scripts/build.js': ['Scripts/*.js']
        }
    }
}

But what if a want to uglify multiple files without bundling and without writing each file - one to one map.

Something like this:

uglify: {
    dist: {
        files: {
            'Scripts/*.min.js': ['Scripts/*.js']
        }
    }
}

Is it possible with either uglify or yui comressor?


Solution

  • I hope this helps:

    grunt.initConfig({
        uglify: {
          test: {
            files: [{
                expand: true,
                src: '*.js',
                dest: 'Scripts',
                cwd: 'Scripts',
                ext: '.min.js'
            }]
          }
        }
    });