         else
 
           controllerName = path.basename(viewDir).replace(path.sep, "")
-          controllerBasenameWithPath = path.join(buildcontrollersDirectory, "#{controllerName}")
+          controllerBasenameWithPath = path.join(buildControllersDirectory, "#{controllerName}")
 
 
 

  grunt.loadNpmTasks 'grunt-contrib-concat'

  grunt.initConfig
    clean:
      dist:
        ["dist/"]

    copy:
      controllers:
        expand: true
        cwd: 'app/controllers'
        src: ['**/*.js', '**/*.coffee']
        dest: 'dist/controllers/'
      models:
        expand:true
        cwd: 'app/models/'
        src: ['**/*.js', '**/*.coffee']
        dest: 'dist/models/'
      statics:
        src: 'www/*'
        dest: 'dist/'

    concat:
      models:
        src: ['dist/models/jes.js', 'dist/models/kaks.js']#'**/*.js'
        dist: 'dist/models/models.js'
        separator: '/n/n'


  grunt.registerTask 'steroids-make', "Create the dist/ folder that is copied to the device.", [
    'steroids-clean-dist',
    'steroids-build-controllers',
    'steroids-build-models',
    'steroids-build-statics',
    'steroids-compile-models',
    'steroids-compile-views',
    'steroids-cordova-merges'
  ]

  # -------------------------------------------
  # CLEAN TASKS

  grunt.registerTask 'steroids-clean-dist', 'Removes dist/ recursively and creates it again ', ->
    grunt.task.run 'clean:dist'
    grunt.file.mkdir "dist/"

  # -------------------------------------------
  # BUILD TASKS

  grunt.registerTask 'steroids-build-controllers', "Build controllers", ->
    grunt.task.run 'copy:controllers'

  grunt.registerTask 'steroids-build-models', "Build models", ->
    grunt.task.run 'copy:models'

  grunt.registerTask 'steroids-build-statics', "Build static files", ->
    grunt.task.run 'copy:statics'

  # -------------------------------------------
  # COMPILE TASKS

  grunt.registerTask 'steroids-compile-models', "Compile models", ->
    grunt.task.run 'concat:models'

  grunt.registerTask 'steroids-compile-views', "Compile views", ->

    projectDirectory          = Paths.applicationDir

    buildDirectory            = path.join projectDirectory, "dist"
    buildViewsDirectory       = path.join buildDirectory, "views"
    buildModelsDirectory      = path.join buildDirectory, "models"
    buildcontrollersDirectory = path.join buildDirectory, "controllers"
    buildStylesheetsDirectory = path.join buildDirectory, "stylesheets"

    appDirectory              = path.join projectDirectory, "app"
    appViewsDirectory         = path.join appDirectory, "views"
    appModelsDirectory        = path.join appDirectory, "models"
    appControllersDirectory   = path.join appDirectory, "controllers"
    appLayoutsDirectory       = path.join appDirectory, "views", "layouts"

    vendorDirectory           = path.join projectDirectory, "vendor"
    wwwDirectory              = path.join projectDirectory, "www"

    viewDirectories = []

    # get each view folder (except layout)
    for dirPath in grunt.file.expand(path.join(appViewsDirectory, "*")) when fs.statSync(dirPath).isDirectory()
      basePath = path.basename(dirPath)
      unless basePath is "layouts" + path.sep or basePath is "layouts"
        viewDirectories.push dirPath
        grunt.file.mkdir path.join(buildViewsDirectory, path.basename(dirPath))


    for viewDir in viewDirectories


      layoutFilePath = path.join appLayoutsDirectory, layoutFileName

      # If no resource-specific layout is found, use application.html
      unless fs.existsSync(layoutFilePath)
        layoutFilePath = path.join appLayoutsDirectory, "application.html"

