           bare: true
           sourceMap: true
           sourceMapDir: 'dist/'
-        files:
-          'dist/moltin.js': [
-            'src/moltin.coffee',
-            'src/features/storage.coffee',
-            'src/features/storage.tvjs.coffee',
-            'src/features/*.coffee'
-          ]
+        files: [
+          {
+            dest: 'dist/moltin.' + ( if target != 'js' then target + '.' else '' ) + 'js'
+            src: [
+              'src/moltin.coffee',
+              'src/' + target + '/ajax.coffee',
+              'src/' + target + '/storage.coffee',
+              'src/abstract.coffee',
+              'src/features/*.coffee'
+              'src/' + target + '/export.coffee'
+            ]
+          }
+        ]
     preprocess:
       inline:
         options:
           context:
-            TARGET: grunt.option('target') || 'js'
+            TARGET: target
           inline: true
-        src: 'dist/moltin.js'
-    concat:
-      options:
-        separator: ';'
-        banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
-          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
-      css:
-        src: ['src/css/*.css']
-        dest: 'dist/moltin.css'
+        src: 'dist/moltin.' + ( if target != 'js' then target + '.' else '' ) + 'js'
+    replace:
+      dist:
+        options:
+          patterns: [
+            {
+              match: /[\t]+;\n/g,
+              replacement: () ->
+                return ''
+            }
+          ]
+        files: [
+          {
+            expand: true,
+            flatten: true,
+            src: ['dist/moltin.' + ( if target != 'js' then target + '.' else '' ) + 'js'],
+            dest: 'dist/'
+          }
+        ]
     karma:
       unit:
         options:

          sourceMap: true
          sourceMapIncludeSources: true
          drop_console: true
          banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */'
        files:
          'dist/moltin.min.js': 'dist/moltin.js'
    cssmin:
      compress:
        options:
          banner: '/*! <%= pkg.name %> minified - v<%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> */' + "\n"
        files:
          'dist/moltin.min.css': ['dist/moltin.css']
    compress:
      main:
        options:

        src: ['*.min.js', '*.min.css', '*.min.map']
        dest: 'dist/gzip/'
    watch:
      files: ['src/*.coffee', 'src/**/*.coffee']
      tasks: ['coffee', 'preprocess:inline', 'replace', 'karma', 'uglify', 'compress']

  # Do we have credentials?
  if grunt.file.exists('aws-credentials.json')
