grunt-contrib-uglify icon indicating copy to clipboard operation
grunt-contrib-uglify copied to clipboard

Files are accidentally combined when ext is defined

Open helgatheviking opened this issue 9 years ago • 3 comments

When I try to find use the bit of code from the readme to dynamically uglify all the files in a folder:

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

If the filenames have . in them uglify gets confused and concatenates files. For example: I have jquery.fitvids.js and jquery.fastclick.js and after running the uglify from above I end up only with jquery.min.js. However, if I drop the ext setting then I get 3 files as expected.

helgatheviking avatar Jun 30 '15 18:06 helgatheviking

I replicated your problem and has the same issue, it only worked correctly when I renamed the files without "jquery.". Just leave the files as .js extensions.

gothburz avatar Jul 01 '15 00:07 gothburz

Yes, it works when I rename the files to remove the "jquery". I think it would be ideal for the grunt plugin to get the file name from whatever preceeds .js instead of first character up until the first .

helgatheviking avatar Jul 01 '15 01:07 helgatheviking

You are welcome to make a PR.

XhmikosR avatar Jul 15 '16 19:07 XhmikosR