javascriptgruntjsfrontendgrunt-contrib-watchgrunt-contrib-uglify

How can I adjust the path to my destination folder?


I'm trying to configure the 'dest' property of uglify (grunt), but I'm having a problem.

This is my code:

    uglify:{
        js: {
            files: [{
                expand: true,
                src: ['js-dev/*.js','js-dev/**/*.js'],
                dest: 'js',
            }]
        }
    }

The problem is when I run my grunt, the final destination folder is js/js-dev/[All my files]. But I just want js/[All my files], without the js-dev.

Does anyone know how I can adjust this?

Thanks!!!


Solution

  • You need to set cwd to js-dev and drop it from your src declarations.

    uglify:{
        js: {
            files: [{
                expand: true,
                cwd: 'js-dev',
                src: ['*.js','**/*.js'],
                dest: '../js',
            }]
        }
    }