title: Best way to concat and uglify js in gulp
body: <p>I am trying to do automation to concat and uglify js in gulp.</p>
  
  <p>Here is my gulpfile.js:</p>
  
  <pre><code>gulp.task('compressjs', function() {
      gulp.src(['public/app/**/*.js','!public/app/**/*.min.js'])
      .pipe(sourcemaps.init())
      .pipe(wrap('(function(){"use strict"; &lt;%= contents %&gt;\n})();'))
      .pipe(uglify())
      .pipe(concat('all.js'))
      .pipe(rename({
          extname: '.min.js'
      }))
      .pipe(sourcemaps.write('.'))
      .pipe(gulp.dest('public/app'));
  })
  </code></pre>
  
  <p>Do you think it is needed to wrap every file with <code>(function(){"use strict"; &lt;%= contents %&gt;\n})();</code> to avoid conflict when every file is being join together? Do you think my gulp task is good, or it can even better for performing it's task?</p>