angularjsnode.jsgruntjsgrunt-contrib-uglify

Grunt uglify - how destination file can have same name as src file with multiple "."


I am new to MEAN & Grunt. I used "ng build --prod --aot" for production of my MEAN stack app and now i have these files in my

dist folder

  1. inline.2b13c4abf73bfbc8e0d1.bundle.js
  2. main.907b8423747dc933c849.bundle.js
  3. polyfills.477545a8be21bde7f43e.bundle.js
  4. vendor.61844e8ff3b3b4fa4491.bundle.js

I am trying to minify these files as these can still be reduced and 30kb size can be saved .

I used grunt with these src and dest :

uglify: {
         files: {
                src: 'dist/*.js',
                dest: 'dist/',
                expand: true,
                flatten: true,
                ext: '.js'
            }

}

On "grunt uglify" command I get the files

  1. inline.js
  2. main.js
  3. polyfills.js
  4. vendor.js

How can I get the same file name that angular build provided me ? And please provide options that can maximize reduction in size(optional) Thanks in advance !


Solution

  • adding extDot worked for me ,

    files: {
                    src: 'dist/*.js',
                    dest: 'dist/',
                    expand: true,
                    flatten: true,
                    ext: '.js',
                    extDot: 'last'
                }