Grunt uglifyjs combining all jquery files

125 views Asked by At

I use the following gruntfile.js

module.exports = function (grunt) {
    grunt.initConfig({

        uglify: {
            files: {
                cwd: 'public/js',
                src: ['**/*.js', '!*.min.js'],
                dest: 'public/js/build/',
                expand: true,
                flatten: true,
                ext: '.js'
            }
        },
        watch: {
           js:  { files: 'public/js/*.js', tasks: [ 'uglify' ] },
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-uglify');

    grunt.registerTask('default', [ 'uglify' ]);
};

I want to minimize all files in the public/js folder. When I run the script, all jquery.js and jquery.plugin.js files are combined into one minimized jquery.js output file. Is there some setting to prevent this?

1

There are 1 answers

0
dingdong On

Ah, just figured it out.

Add

extDot: 'last'

as an option to uglify.