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