   ]
   coffee: [
     'bower_components/este-library/este/**/*.coffee'
-    'client/**/*.coffee'
-    'server/**/*.coffee'
+    'client/**/js/**/*.coffee'
+    'server/**/js/**/*.coffee'
   ]
   react: [
-    'client/**/*.jsx'
-    'server/**/*.jsx'
+    # Why this crazy /**/js/** pattern? Because one server app can have several
+    # compilation targets: client/app, client/admin, client/landingpage etc.
+    # This pattern ensures that client/whatever/build directories are ignored.
+    'client/**/js/**/*.jsx'
+    'server/**/js/**/*.jsx'
   ]
   depsPrefix: '../../../..'
   nodejs: 'bower_components/closure-library/closure/goog/bootstrap/nodejs'
   unitTests: [
     'bower_components/este-library/este/**/*_test.js'
-    'client/**/*_test.js'
+    'client/**/js/**/*_test.js'
+    'client/**/js/**/*_test.js'
   ]
   compile: [
     'bower_components/closure-library/**/*.js'
     'bower_components/este-library/este/**/*.js'
-    'client/**/*.js'
-    'server/**/*.js'
+    'client/**/js/**/*.js'
+    'server/**/js/**/*.js'
     'tmp/**/*.js'
   ]
   packages: './*.json'

  require './' + paths.nodejs
  require './' + 'tmp/deps0.js'

  # For watch mode, run foo_test.js when foo.js is changed.
  if changedFilePath && !/_test\.js$/.test changedFilePath
    changedFilePath = changedFilePath.replace '.js', '_test.js'

  autoRequire = (file) ->
    jsPath = file.path.replace '_test.js', '.js'
    return false if not fs.existsSync jsPath


gulp.task 'react', ->
  gulp.src changedFilePath ? paths.react, base: '.'
    .pipe react harmony: true
    .pipe gulp.dest '.'

gulp.task 'deps', ->
