JJ Allaire | 2ec4024 | 2014-09-15 09:18:39 -0400 | [diff] [blame] | 1 | /* global module:false */ |
| 2 | module.exports = function(grunt) { |
| 3 | var port = grunt.option('port') || 8000; |
| 4 | // Project configuration |
| 5 | grunt.initConfig({ |
| 6 | pkg: grunt.file.readJSON('package.json'), |
| 7 | meta: { |
| 8 | banner: |
| 9 | '/*!\n' + |
| 10 | ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' + |
| 11 | ' * http://lab.hakim.se/reveal-js\n' + |
| 12 | ' * MIT licensed\n' + |
| 13 | ' *\n' + |
| 14 | ' * Copyright (C) 2013 Hakim El Hattab, http://hakim.se\n' + |
| 15 | ' */' |
| 16 | }, |
| 17 | |
| 18 | qunit: { |
| 19 | files: [ 'test/*.html' ] |
| 20 | }, |
| 21 | |
| 22 | uglify: { |
| 23 | options: { |
| 24 | banner: '<%= meta.banner %>\n' |
| 25 | }, |
| 26 | build: { |
| 27 | src: 'js/reveal.js', |
| 28 | dest: 'js/reveal.min.js' |
| 29 | } |
| 30 | }, |
| 31 | |
| 32 | cssmin: { |
| 33 | compress: { |
| 34 | files: { |
| 35 | 'css/reveal.min.css': [ 'css/reveal.css' ] |
| 36 | } |
| 37 | } |
| 38 | }, |
| 39 | |
| 40 | sass: { |
| 41 | main: { |
| 42 | files: { |
| 43 | 'css/theme/default.css': 'css/theme/source/default.scss', |
| 44 | 'css/theme/beige.css': 'css/theme/source/beige.scss', |
| 45 | 'css/theme/night.css': 'css/theme/source/night.scss', |
| 46 | 'css/theme/serif.css': 'css/theme/source/serif.scss', |
| 47 | 'css/theme/simple.css': 'css/theme/source/simple.scss', |
| 48 | 'css/theme/sky.css': 'css/theme/source/sky.scss', |
| 49 | 'css/theme/moon.css': 'css/theme/source/moon.scss', |
| 50 | 'css/theme/solarized.css': 'css/theme/source/solarized.scss', |
| 51 | 'css/theme/blood.css': 'css/theme/source/blood.scss' |
| 52 | } |
| 53 | } |
| 54 | }, |
| 55 | |
| 56 | jshint: { |
| 57 | options: { |
| 58 | curly: false, |
| 59 | eqeqeq: true, |
| 60 | immed: true, |
| 61 | latedef: true, |
| 62 | newcap: true, |
| 63 | noarg: true, |
| 64 | sub: true, |
| 65 | undef: true, |
| 66 | eqnull: true, |
| 67 | browser: true, |
| 68 | expr: true, |
| 69 | globals: { |
| 70 | head: false, |
| 71 | module: false, |
| 72 | console: false, |
| 73 | unescape: false |
| 74 | } |
| 75 | }, |
| 76 | files: [ 'Gruntfile.js', 'js/reveal.js' ] |
| 77 | }, |
| 78 | |
| 79 | connect: { |
| 80 | server: { |
| 81 | options: { |
| 82 | port: port, |
| 83 | base: '.' |
| 84 | } |
| 85 | } |
| 86 | }, |
| 87 | |
| 88 | zip: { |
| 89 | 'reveal-js-presentation.zip': [ |
| 90 | 'index.html', |
| 91 | 'css/**', |
| 92 | 'js/**', |
| 93 | 'lib/**', |
| 94 | 'images/**', |
| 95 | 'plugin/**' |
| 96 | ] |
| 97 | }, |
| 98 | |
| 99 | watch: { |
| 100 | main: { |
| 101 | files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ], |
| 102 | tasks: 'default' |
| 103 | }, |
| 104 | theme: { |
| 105 | files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ], |
| 106 | tasks: 'themes' |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | }); |
| 111 | |
| 112 | // Dependencies |
| 113 | grunt.loadNpmTasks( 'grunt-contrib-qunit' ); |
| 114 | grunt.loadNpmTasks( 'grunt-contrib-jshint' ); |
| 115 | grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); |
| 116 | grunt.loadNpmTasks( 'grunt-contrib-uglify' ); |
| 117 | grunt.loadNpmTasks( 'grunt-contrib-watch' ); |
| 118 | grunt.loadNpmTasks( 'grunt-contrib-sass' ); |
| 119 | grunt.loadNpmTasks( 'grunt-contrib-connect' ); |
| 120 | grunt.loadNpmTasks( 'grunt-zip' ); |
| 121 | |
| 122 | // Default task |
| 123 | grunt.registerTask( 'default', [ 'jshint', 'cssmin', 'uglify', 'qunit' ] ); |
| 124 | |
| 125 | // Theme task |
| 126 | grunt.registerTask( 'themes', [ 'sass' ] ); |
| 127 | |
| 128 | // Package presentation to archive |
| 129 | grunt.registerTask( 'package', [ 'default', 'zip' ] ); |
| 130 | |
| 131 | // Serve presentation locally |
| 132 | grunt.registerTask( 'serve', [ 'connect', 'watch' ] ); |
| 133 | |
| 134 | // Run tests |
| 135 | grunt.registerTask( 'test', [ 'jshint', 'qunit' ] ); |
| 136 | |
| 137 | }; |