title: Grunt a TypeScript to JavaScript with uglify
body: <p>I have 4 TypeScript files under the <strong>ts</strong> directory. I can compile them all into one file (main.js) with a source map (main.js.map) using the <code>typescript:base</code> task.</p>
  
  <p>However, trying to <code>uglify</code> those files is not working when compiling <em>more than one</em> TypeScript file. It's as if <code>uglify</code> is getting confused when the <code>sourceMapIn</code> was made with more than one file.</p>
  
  <p>How would you compile a TypeScript project with more than one file, into one file with a sourcemap (Back to the original ts files)</p>
  
  <p>Here's the grunt file:</p>
  
  <pre><code>module.exports = function (grunt) {
      grunt.initConfig({
          uglify: {
              dist: {
                  options: {
                      sourceMap: '../js/main.min.map',
                      sourceMapIn: 'main.js.map',
                      sourceMapRoot: '../ts/'
                  },
                  files: {
                      '../js/main.min.js': ['main.js']
                  }
              }
          },
          typescript: {
              base: {
                   src: ['**/*.ts'],
                   dest: '../js/main.js',
                   options: {
                       module: 'amd',
                       sourcemap: true,
                       declaration: false
                   }
               }
  
          }
      });
  
      grunt.loadNpmTasks('grunt-contrib-uglify');
      grunt.loadNpmTasks('grunt-typescript');
  
      grunt.file.setBase('../ts');
  
      grunt.registerTask('default', ['typescript:base', 'uglify:dist']);
  };
  </code></pre>
  
  <p>Thanks!</p>