|
| 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) 2015 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 | + sass: { |
| 33 | + core: { |
| 34 | + files: { |
| 35 | + 'css/reveal.css': 'css/reveal.scss', |
| 36 | + } |
| 37 | + }, |
| 38 | + themes: { |
| 39 | + files: { |
| 40 | + 'css/theme/black.css': 'css/theme/source/black.scss', |
| 41 | + 'css/theme/white.css': 'css/theme/source/white.scss', |
| 42 | + 'css/theme/league.css': 'css/theme/source/league.scss', |
| 43 | + 'css/theme/beige.css': 'css/theme/source/beige.scss', |
| 44 | + 'css/theme/night.css': 'css/theme/source/night.scss', |
| 45 | + 'css/theme/serif.css': 'css/theme/source/serif.scss', |
| 46 | + 'css/theme/simple.css': 'css/theme/source/simple.scss', |
| 47 | + 'css/theme/sky.css': 'css/theme/source/sky.scss', |
| 48 | + 'css/theme/moon.css': 'css/theme/source/moon.scss', |
| 49 | + 'css/theme/solarized.css': 'css/theme/source/solarized.scss', |
| 50 | + 'css/theme/blood.css': 'css/theme/source/blood.scss' |
| 51 | + } |
| 52 | + } |
| 53 | + }, |
| 54 | + |
| 55 | + autoprefixer: { |
| 56 | + dist: { |
| 57 | + src: 'css/reveal.css' |
| 58 | + } |
| 59 | + }, |
| 60 | + |
| 61 | + cssmin: { |
| 62 | + compress: { |
| 63 | + files: { |
| 64 | + 'css/reveal.min.css': [ 'css/reveal.css' ] |
| 65 | + } |
| 66 | + } |
| 67 | + }, |
| 68 | + |
| 69 | + jshint: { |
| 70 | + options: { |
| 71 | + curly: false, |
| 72 | + eqeqeq: true, |
| 73 | + immed: true, |
| 74 | + latedef: true, |
| 75 | + newcap: true, |
| 76 | + noarg: true, |
| 77 | + sub: true, |
| 78 | + undef: true, |
| 79 | + eqnull: true, |
| 80 | + browser: true, |
| 81 | + expr: true, |
| 82 | + globals: { |
| 83 | + head: false, |
| 84 | + module: false, |
| 85 | + console: false, |
| 86 | + unescape: false, |
| 87 | + define: false, |
| 88 | + exports: false |
| 89 | + } |
| 90 | + }, |
| 91 | + files: [ 'Gruntfile.js', 'js/reveal.js' ] |
| 92 | + }, |
| 93 | + |
| 94 | + connect: { |
| 95 | + server: { |
| 96 | + options: { |
| 97 | + port: port, |
| 98 | + base: '.', |
| 99 | + livereload: true, |
| 100 | + open: true |
| 101 | + } |
| 102 | + } |
| 103 | + }, |
| 104 | + |
| 105 | + zip: { |
| 106 | + 'reveal-js-presentation.zip': [ |
| 107 | + 'index.html', |
| 108 | + 'css/**', |
| 109 | + 'js/**', |
| 110 | + 'lib/**', |
| 111 | + 'images/**', |
| 112 | + 'plugin/**' |
| 113 | + ] |
| 114 | + }, |
| 115 | + |
| 116 | + watch: { |
| 117 | + options: { |
| 118 | + livereload: true |
| 119 | + }, |
| 120 | + js: { |
| 121 | + files: [ 'Gruntfile.js', 'js/reveal.js' ], |
| 122 | + tasks: 'js' |
| 123 | + }, |
| 124 | + theme: { |
| 125 | + files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ], |
| 126 | + tasks: 'css-themes' |
| 127 | + }, |
| 128 | + css: { |
| 129 | + files: [ 'css/reveal.scss' ], |
| 130 | + tasks: 'css-core' |
| 131 | + }, |
| 132 | + html: { |
| 133 | + files: [ 'index.html'] |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + }); |
| 138 | + |
| 139 | + // Dependencies |
| 140 | + grunt.loadNpmTasks( 'grunt-contrib-qunit' ); |
| 141 | + grunt.loadNpmTasks( 'grunt-contrib-jshint' ); |
| 142 | + grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); |
| 143 | + grunt.loadNpmTasks( 'grunt-contrib-uglify' ); |
| 144 | + grunt.loadNpmTasks( 'grunt-contrib-watch' ); |
| 145 | + grunt.loadNpmTasks( 'grunt-sass' ); |
| 146 | + grunt.loadNpmTasks( 'grunt-contrib-connect' ); |
| 147 | + grunt.loadNpmTasks( 'grunt-autoprefixer' ); |
| 148 | + grunt.loadNpmTasks( 'grunt-zip' ); |
| 149 | + |
| 150 | + // Default task |
| 151 | + grunt.registerTask( 'default', [ 'css', 'js' ] ); |
| 152 | + |
| 153 | + // JS task |
| 154 | + grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] ); |
| 155 | + |
| 156 | + // Theme CSS |
| 157 | + grunt.registerTask( 'css-themes', [ 'sass:themes' ] ); |
| 158 | + |
| 159 | + // Core framework CSS |
| 160 | + grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] ); |
| 161 | + |
| 162 | + // All CSS |
| 163 | + grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] ); |
| 164 | + |
| 165 | + // Package presentation to archive |
| 166 | + grunt.registerTask( 'package', [ 'default', 'zip' ] ); |
| 167 | + |
| 168 | + // Serve presentation locally |
| 169 | + grunt.registerTask( 'serve', [ 'connect', 'watch' ] ); |
| 170 | + |
| 171 | + // Run tests |
| 172 | + grunt.registerTask( 'test', [ 'jshint', 'qunit' ] ); |
| 173 | + |
| 174 | +}; |
0 commit comments