/* global module:false */
module.exports = function(grunt) {

  // Project configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    meta: {
      banner:
        '/*!\n' +
        ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
        ' * http://lab.hakim.se/reveal-js\n' +
        ' * MIT licensed\n' +
        ' *\n' +
        ' * Copyright (C) 2013 Hakim El Hattab, http://hakim.se\n' +
        ' */'
    },

    // Tests will be added soon
    qunit: {
      files: [ 'test/**/*.html' ]
    },

    uglify: {
      options: {
        banner: '<%= meta.banner %>\n'
      },
      build: {
        src: 'js/reveal.js',
        dest: 'js/reveal.min.js'
      }
    },

    cssmin: {
      compress: {
        files: {
          'css/reveal.min.css': [ 'css/reveal.css' ]
        }
      }
    },

    sass: {
      main: {
        files: {
          'css/theme/default.css': 'css/theme/source/default.scss',
          'css/theme/beige.css': 'css/theme/source/beige.scss',
          'css/theme/night.css': 'css/theme/source/night.scss',
          'css/theme/serif.css': 'css/theme/source/serif.scss',
          'css/theme/simple.css': 'css/theme/source/simple.scss',
          'css/theme/sky.css': 'css/theme/source/sky.scss',
          'css/theme/moon.css': 'css/theme/source/moon.scss',
          'css/theme/solarized.css': 'css/theme/source/solarized.scss'
        }
      }
    },

    jshint: {
      options: {
        curly: false,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        eqnull: true,
        browser: true,
        expr: true,
        globals: {
          head: false,
          module: false,
          console: false,

          // Test.
          it: false,
          describe: false,
          expect: false,

          // Demo.
          hello: true,
          camelCase: true
        }
      },
      files: [
        "Gruntfile.js",
        "example/js/app/**/*.js",
        "example/js/spec/**/*.js"
      ]
    },

    jade: {
      compile: {
        options: {
          pretty: true
        },
        files: {
          "index.html":               ["_templates/index.jade"],
          "example/test-empty.html":  ["_templates/example/test-layout.jade"],
          "example/test-mocha.html":  ["_templates/example/test-mocha.jade"],
          "example/test.html":        ["_templates/example/test.jade"]
        }
      }
    },

    copy: {
      test: {
        files: [
          {
            dest: "skeleton/js/lib",
            expand: true,
            flatten: true,
            src: [
              "bower_components/mocha/mocha.js",
              "bower_components/mocha/mocha.css",
              "bower_components/chai/chai.js"
            ]
          },
          {
            dest: "skeleton/js/lib/sinon.js",
            src: "bower_components/sinon/index.js"
          }
        ]
      }
    },

    watch: {
      jade: {
        files: [
          "_templates/**/*.jade"
        ],
        tasks: [
          "jade"
        ],
        options: {
          spawn: false,
          atBegin: true
        }
      }
      // main: {
      //   files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
      //   tasks: 'default'
      // },
      // theme: {
      //   files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
      //   tasks: 'themes'
      // }
    }

  });

  // Dependencies
  grunt.loadNpmTasks( 'grunt-contrib-copy' );
  grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
  grunt.loadNpmTasks( 'grunt-contrib-uglify' );
  grunt.loadNpmTasks( 'grunt-contrib-watch' );
  grunt.loadNpmTasks( 'grunt-contrib-sass' );
  grunt.loadNpmTasks( 'grunt-contrib-jade' );

  // Default task
  grunt.registerTask( 'default', [ 'jshint', 'cssmin', 'uglify' ] );

  // Theme task
  grunt.registerTask( 'themes', [ 'sass' ] );

};

@@ -3088,24 +3088,53 @@
 s/**/*.jade%22
+,%0A          %22example/**/*.js%22
 %0A        %5D,%0A

Update watch.