 
     # Cleans build folders
     clean: {
-      scripts: ['build/scripts'],
-      styles:  ['build/styles']
+      core: [
+        'build/scripts/**/*.js',
+        '!build/scripts/<%= pkg.name %>/ui.js',
+        '!build/scripts/<%= pkg.name %>/ui/**/*.js'
+      ],
+      ui: [
+        'build/scripts/<%= pkg.name %>/ui.js',
+        'build/scripts/<%= pkg.name %>/ui/**/*.js'
+      ]
     },
 
     # Compiles CoffeeScript source
     coffee: {
-      all: {
+      options: {
+        bare: true
+      }
+      core: {
         expand: true,
         cwd: 'src',
-        src: '**/*.coffee',
+        src: [
+          'scripts/**/*.coffee',
+          '!scripts/<%= pkg.name %>/ui.coffee',
+          '!scripts/<%= pkg.name %>/ui/**/*.coffee'
+        ],
         dest: 'build',
-        ext: '.js',
-        options: {
-          bare: true
-        }
+        ext: '.js'
+      },
+      ui: {
+        expand: true,
+        cwd: 'src',
+        src: [
+          'scripts/<%= pkg.name %>/ui.coffee',
+          'scripts/<%= pkg.name %>/ui/**/*.coffee'
+        ],
+        dest: 'build',
+        ext: '.js'
       }
     },
 

        eqnull: true,
        shadow: true
      },
      files: [
        'build/**/*.js'
      ]
    },

    # Minified distribution


    # Watch for file changes
    watch: {
      grunt: {
        files: ['Gruntfile.coffee'],
        tasks: ['build']
      }
      core: {
        files: [
          'src/scripts/**/*.coffee',
          '!src/scripts/<%= pkg.name %>/ui.coffee',
          '!src/scripts/<%= pkg.name %>/ui/**/*.coffee'
        ],
        tasks: ['build:core']
      }
      ui: {
        files: [
          'src/scripts/<%= pkg.name %>/ui.coffee',
          'src/scripts/<%= pkg.name %>/ui/**/*.coffee'
        ],
        tasks: ['build:ui']
      }
    }
  }

