title: requirejs optimization with gulp
body: <p>I am using requirejs and gulp to build angular app. I am using <code>amd-optimize</code> and <code>gulp-requirejs-optimize</code> to add all js files into single file. Here is my <code>main.js</code> file: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>require.config(
      {
          paths: {
              app             : 'app',
              angular         : '../bower_components/angular/angular',
              jquery          : '../bower_components/jquery/dist/jquery',
              angularResource : '../bower_components/angular-resource/angular-resource',
              angularRoute    : '../bower_components/angular-route/angular-route',
              publicModule    : 'public_module',
              route           : 'route'
          },
          shim: {
              'app': {
                  deps: ['angular']
              },
              'angularRoute': ['angular'],
              angular : {exports : 'angular'}
          }
      }
  );</code></pre>
  </div>
  </div>
  </p>
  
  <p>And <code>gulpfile.js</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var gulp    = require('gulp');
  var rjs     = require('gulp-requirejs');
  var connect = require('gulp-connect');
  var requirejsOptimize = require('gulp-requirejs-optimize');
  var amdOptimize = require('amd-optimize');
  var concat = require('gulp-concat');
  
  // using amd-optimize.
  gulp.task('bundle', function () {
      return gulp.src('app/**/*.js')
          .pipe(amdOptimize('main'))
          .pipe(concat('main-bundle.js'))
          .pipe(gulp.dest('dist'));
  });
  
  // using gulp-requirejs-optimize.
  gulp.task('scripts', function () {
      return gulp.src('app/main.js')
          .pipe(requirejsOptimize())
          .pipe(gulp.dest('dist'));
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I run <code>gulp bundle</code> or <code>gulp scripts</code>, it shows me same content of <code>main.js</code> file in output file(not showing all js template in one output file).</p>
  
  <p>The output file is: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>require.config({
      paths: {
          angular: '../bower_components/angular/angular',
          jquery: '../bower_components/jquery/dist/jquery',
          angularResource: '../bower_components/angular-resource/angular-resource',
          angularRoute: '../bower_components/angular-route/angular-route',
          publicModule: 'public_module',
          route: 'route'
      },
      shim: {
          'app': { deps: ['angular'] },
          'angularRoute': ['angular'],
          angular: { exports: 'angular' }
      }
  });
  define('main', [], function () {
      return;
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>How can I configure gulp to put every js template into one js file?</p>