0

I want to use this grunt uglify setup shown in the accepted answer here: How to minify multiple Javascript files in a folder with UglifyJS?

However I only want to run it on files that are unminified, can uglify check this or not?

If not, any way of making it do this? Either by checking the size of the file/number of lines or maybe just checking if the file name ends in '.min.js'

Community
  • 1
  • 1
Joe Taylor
  • 579
  • 1
  • 6
  • 21

2 Answers2

3

When you set the src for the uglify task to

src: ['js/*.js', '!js/*.min.js'],

All the .min.jsfiles are not processed by uglify.

See also: http://gruntjs.com/configuring-tasks#globbing-patterns

Qurben
  • 1,276
  • 1
  • 10
  • 21
0

You need to follow these build steps:

  1. Minify only the unminified assets by using a specific globbing pattern (like the one suggested by @Qurben) src: ['js/*.js', '!js/*.min.js']
  2. You need to CONCAT the already minified files along with the newly [your] minified application to produce the final result.
thanpolas
  • 848
  • 1
  • 8
  • 20