text: // Generated on 2013-12-08 using generator-webapp 0.4.4
  'use strict';
  
  // # Globbing
  // for performance reasons we're only matching one level down:
  // 'test/spec/{,*/}*.js'
  // use this if you want to recursively match all subfolders:
  // 'test/spec/**/*.js'
  
  module.exports = function (grunt) {
      // show elapsed time at the end
      require('time-grunt')(grunt);
      // load all grunt tasks
      require('load-grunt-tasks')(grunt);
  
      grunt.initConfig({
          // configurable paths
          yeoman: {
              app: 'app',
              dist: 'dist'
          },
          watch: {
              coffee: {
                  files: ['<%= yeoman.app %>/scripts/{,*/}*.{coffee,litcoffee,coffee.md}'],
                  tasks: ['coffee:dist']
              },
              coffeeTest: {
                  files: ['test/spec/{,*/}*.{coffee,litcoffee,coffee.md}'],
                  tasks: ['coffee:test']
              },
              compass: {
                  files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                  tasks: ['compass:server', 'autoprefixer']
              },
              styles: {
                  files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
                  tasks: ['copy:styles', 'autoprefixer']
              },
              livereload: {
                  options: {
                      livereload: '<%= connect.options.livereload %>'
                  },
                  files: [
                      '<%= yeoman.app %>/*.html',
                      '.tmp/styles/{,*/}*.css',
                      '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                      '<%= yeoman.app %>/images/{,*/}*.{gif,jpeg,jpg,png,svg,webp}'
                  ]
              }
          },
          connect: {
              options: {
                  port: 9000,
                  livereload: 35729,
                  // change this to '0.0.0.0' to access the server from outside
                  hostname: '0.0.0.0'
              },
              livereload: {
                  options: {
                      open: true,
                      base: [
                          '.tmp',
                          '<%= yeoman.app %>'
                      ]
                  }
              },
              test: {
                  options: {
                      base: [
                          '.tmp',
                          'test',
                          '<%= yeoman.app %>'
                      ]
                  }
              },
              dist: {
                  options: {
                      open: true,
                      base: '<%= yeoman.dist %>',
                      livereload: false
                  }
              }
          },
          clean: {
              dist: {
                  files: [{
                      dot: true,
                      src: [
                          '.tmp',
                          '<%= yeoman.dist %>/*',
                          '!<%= yeoman.dist %>/.git*'
                      ]
                  }]
              },
              server: '.tmp'
          },
          jshint: {
              options: {
                  jshintrc: '.jshintrc',
                  reporter: require('jshint-stylish')
              },
              all: [
                  'Gruntfile.js',
                  '<%= yeoman.app %>/scripts/{,*/}*.js',
                  '!<%= yeoman.app %>/scripts/vendor/*',
                  'test/spec/{,*/}*.js'
              ]
          },
          mocha: {
              all: {
                  options: {
                      run: true,
                      urls: ['http://<%= connect.test.options.hostname %>:<%= connect.test.options.port %>/index.html']
                  }
              }
          },
          coffee: {
              dist: {
                  files: [{
                      expand: true,
                      cwd: '<%= yeoman.app %>/scripts',
                      src: '{,*/}*.{coffee,litcoffee,coffee.md}',
                      dest: '.tmp/scripts',
                      ext: '.js'
                  }]
              },
              test: {
                  files: [{
                      expand: true,
                      cwd: 'test/spec',
                      src: '{,*/}*.{coffee,litcoffee,coffee.md}',
                      dest: '.tmp/spec',
                      ext: '.js'
                  }]
              }
          },
          compass: {
              options: {
                  sassDir: '<%= yeoman.app %>/styles',
                  cssDir: '.tmp/styles',
                  generatedImagesDir: '.tmp/images/generated',
                  imagesDir: '<%= yeoman.app %>/images',
                  javascriptsDir: '<%= yeoman.app %>/scripts',
                  fontsDir: '<%= yeoman.app %>/styles/fonts',
                  importPath: '<%= yeoman.app %>/bower_components',
                  httpImagesPath: '/images',
                  httpGeneratedImagesPath: '/images/generated',
                  httpFontsPath: '/styles/fonts',
                  relativeAssets: false,
                  assetCacheBuster: false
              },
              dist: {
                  options: {
                      generatedImagesDir: '<%= yeoman.dist %>/images/generated'
                  }
              },
              server: {
                  options: {
                      debugInfo: true
                  }
              }
          },
          autoprefixer: {
              options: {
                  browsers: ['last 1 version']
              },
              dist: {
                  files: [{
                      expand: true,
                      cwd: '.tmp/styles/',
                      src: '{,*/}*.css',
                      dest: '.tmp/styles/'
                  }]
              }
          },
          // not used since Uglify task does concat,
          // but still available if needed
          /*concat: {
              dist: {}
          },*/
          // not enabled since usemin task does concat and uglify
          // check index.html to edit your build targets
          // enable this task if you prefer defining your build targets here
          /*uglify: {
              dist: {}
          },*/
          'bower-install': {
              app: {
                  html: '<%= yeoman.app %>/index.html',
                  ignorePath: '<%= yeoman.app %>/'
              }
          },
          rev: {
              dist: {
                  files: {
                      src: [
                          '<%= yeoman.dist %>/scripts/{,*/}*.js',
                          '<%= yeoman.dist %>/styles/{,*/}*.css',
                          '<%= yeoman.dist %>/images/{,*/}*.{gif,jpeg,jpg,png,webp}',
                          '<%= yeoman.dist %>/sounds/{,*/}*.mp3',
                          '<%= yeoman.dist %>/styles/fonts/{,*/}*.*'
                      ]
                  }
              },
              manifest: {
                  files: {
                      src: [
                          '<%= yeoman.dist %>/{,*/}*.json',
                      ]
                  }
              }
          },
          replace: {
              dist: {
                  src: ['<%= yeoman.app %>/index.html'],
                  dest: ['.tmp/index.html'],
                  replacements: [{
                      from: /data-main="(.*)" src="bower_components\/requirejs\/require.js"/,
                      to: 'src="$1"'
                  }]
              }
          },
          useminPrepare: {
              options: {
                  dest: '<%= yeoman.dist %>',
                  flow: {
                      html: {
                          steps: {
                              'js': [ 'concat', 'requirejs' ],
                              'css': [ 'concat', 'cssmin' ]
                          },
                          post: {}
                      }
                  }
              },
              html: '.tmp/index.html'
          },
          requirejs: {
              options: {
                  baseUrl: '.tmp/scripts',
                  mainConfigFile: '.tmp/scripts/main.js',
                  include: ['main'],
                  stubModules: [
                    'EaselJS',
                    'TweenJS',
                    'SoundJS'
                  ],
                  insertRequire: ['main'],
                  name: '../bower_components/almond/almond',
                  out: 'dist/scripts/main.js',
                  optimize: 'uglify2',
                  generateSourceMaps: false,
                  preserveLicenseComments: false
              }
          },
          usemin: {
              options: {
                  assetsDirs: ['<%= yeoman.dist %>', '<%= yeoman.dist %>/images'],
                  patterns: {
                    json: [
                      [/(\w+\.png)/, 'Replacing reference to PNGs']
                    ]
                  }
              },
              json: ['<%= yeoman.dist %>/{,*/}*.json'],
              html: ['<%= yeoman.dist %>/{,*/}*.html'],
              css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
          },
          imagemin: {
              dist: {
                  files: [{
                      expand: true,
                      cwd: '<%= yeoman.app %>/images',
                      src: '{,*/}*.{gif,jpeg,jpg,png}',
                      dest: '<%= yeoman.dist %>/images'
                  }]
              }
          },
          svgmin: {
              dist: {
                  files: [{
                      expand: true,
                      cwd: '<%= yeoman.app %>/images',
                      src: '{,*/}*.svg',
                      dest: '<%= yeoman.dist %>/images'
                  }]
              }
          },
          cssmin: {
              // This task is pre-configured if you do not wish to use Usemin
              // blocks for your CSS. By default, the Usemin block from your
              // `index.html` will take care of minification, e.g.
              //
              //     <!-- build:css({.tmp,app}) styles/main.css -->
              //
              // dist: {
              //     files: {
              //         '<%= yeoman.dist %>/styles/main.css': [
              //             '.tmp/styles/{,*/}*.css',
              //             '<%= yeoman.app %>/styles/{,*/}*.css'
              //         ]
              //     }
              // }
          },
          htmlmin: {
              dist: {
                  options: {
                      /*removeCommentsFromCDATA: true,
                      // https://github.com/yeoman/grunt-usemin/issues/44
                      //collapseWhitespace: true,
                      collapseBooleanAttributes: true,
                      removeAttributeQuotes: true,
                      removeRedundantAttributes: true,
                      useShortDoctype: true,
                      removeEmptyAttributes: true,
                      removeOptionalTags: true*/
                  },
                  files: [{
                      expand: true,
                      cwd: '.tmp',
                      src: '*.html',
                      dest: '<%= yeoman.dist %>'
                  }]
              }
          },
          // Put files not handled in other tasks here
          copy: {
              dist: {
                  files: [{
                      expand: true,
                      dot: true,
                      cwd: '<%= yeoman.app %>',
                      dest: '<%= yeoman.dist %>',
                      src: [
                          '*.{ico,png,txt}',
                          '{,*/}*.json',
                          '.htaccess',
                          'images/{,*/}*.{webp,gif}',
                          'sounds/{,*/}*.mp3',
                          'styles/fonts/{,*/}*.*'
                      ]
                  }, {
                      expand: true,
                      dot: true,
                      cwd: '.tmp/concat/',
                      dest: '<%= yeoman.dist %>',
                      src: ['scripts/vendors.js']
                  }]
              },
              styles: {
                  expand: true,
                  dot: true,
                  cwd: '<%= yeoman.app %>/styles',
                  dest: '.tmp/styles/',
                  src: '{,*/}*.css'
              },
              // move JS libraries from app to .tmp so requirejs can find them
              bower: {
                  expand: true,
                  dot: true,
                  cwd: '<%= yeoman.app %>/bower_components',
                  dest: '.tmp/bower_components/',
                  src: '**/*.js'
              }
          },
          concurrent: {
              server: [
                  'compass',
                  'coffee:dist',
                  'copy:styles'
              ],
              test: [
                  'coffee',
                  'copy:styles'
              ],
              dist: [
                  'coffee',
                  'compass',
                  'copy:styles',
                  'copy:bower',
                  'imagemin',
                  'svgmin',
                  'htmlmin'
              ]
          },
          'gh-pages': {
              options: {
                  base: 'dist'
              },
              src: [ '**' ]
          }
      });
  
      grunt.registerTask('serve', function (target) {
          if (target === 'dist') {
              return grunt.task.run(['build', 'connect:dist:keepalive']);
          }
  
          grunt.task.run([
              'clean:server',
              'concurrent:server',
              'autoprefixer',
              'connect:livereload',
              'watch'
          ]);
      });
  
      grunt.registerTask('server', function () {
          grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
          grunt.task.run(['serve']);
      });
  
      grunt.registerTask('test', [
          'clean:server',
          'concurrent:test',
          'autoprefixer',
          'connect:test',
          'mocha'
      ]);
  
      grunt.registerTask('build', [
          'clean:dist',
          'replace',
          'useminPrepare',
          'concurrent:dist',
          'autoprefixer',
          'concat',
          'cssmin',
          'requirejs',
          'copy:dist',
          'rev:dist',
          'usemin:css',
          'usemin:json',
          'rev:manifest',
          'usemin:html'
      ]);
  
      grunt.registerTask('default', [
          'build',
          'gh-pages'
      ]);
  };
  