blob: 3e67b9f05d841084831031749aa81c18375ce926 [file] [log] [blame]
JJ Allaire2ec40242014-09-15 09:18:39 -04001/* global module:false */
2module.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' +
timelyportfoliobbdec0b2015-03-05 08:51:24 -060014 ' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
JJ Allaire2ec40242014-09-15 09:18:39 -040015 ' */'
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
JJ Allaire2ec40242014-09-15 09:18:39 -040032 sass: {
timelyportfoliobbdec0b2015-03-05 08:51:24 -060033 core: {
JJ Allaire2ec40242014-09-15 09:18:39 -040034 files: {
timelyportfoliobbdec0b2015-03-05 08:51:24 -060035 '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',
JJ Allaire2ec40242014-09-15 09:18:39 -040043 '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
timelyportfoliobbdec0b2015-03-05 08:51:24 -060055 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
JJ Allaire2ec40242014-09-15 09:18:39 -040069 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,
timelyportfoliobbdec0b2015-03-05 08:51:24 -060086 unescape: false,
87 define: false,
88 exports: false
JJ Allaire2ec40242014-09-15 09:18:39 -040089 }
90 },
91 files: [ 'Gruntfile.js', 'js/reveal.js' ]
92 },
93
94 connect: {
95 server: {
96 options: {
97 port: port,
timelyportfoliobbdec0b2015-03-05 08:51:24 -060098 base: '.',
99 livereload: true,
100 open: true
JJ Allaire2ec40242014-09-15 09:18:39 -0400101 }
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: {
timelyportfoliobbdec0b2015-03-05 08:51:24 -0600117 options: {
118 livereload: true
119 },
120 js: {
121 files: [ 'Gruntfile.js', 'js/reveal.js' ],
122 tasks: 'js'
JJ Allaire2ec40242014-09-15 09:18:39 -0400123 },
124 theme: {
125 files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
timelyportfoliobbdec0b2015-03-05 08:51:24 -0600126 tasks: 'css-themes'
127 },
128 css: {
129 files: [ 'css/reveal.scss' ],
130 tasks: 'css-core'
131 },
132 html: {
133 files: [ 'index.html']
134 }
JJ Allaire2ec40242014-09-15 09:18:39 -0400135 }
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' );
timelyportfoliobbdec0b2015-03-05 08:51:24 -0600145 grunt.loadNpmTasks( 'grunt-sass' );
JJ Allaire2ec40242014-09-15 09:18:39 -0400146 grunt.loadNpmTasks( 'grunt-contrib-connect' );
timelyportfoliobbdec0b2015-03-05 08:51:24 -0600147 grunt.loadNpmTasks( 'grunt-autoprefixer' );
JJ Allaire2ec40242014-09-15 09:18:39 -0400148 grunt.loadNpmTasks( 'grunt-zip' );
149
150 // Default task
timelyportfoliobbdec0b2015-03-05 08:51:24 -0600151 grunt.registerTask( 'default', [ 'css', 'js' ] );
JJ Allaire2ec40242014-09-15 09:18:39 -0400152
timelyportfoliobbdec0b2015-03-05 08:51:24 -0600153 // 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' ] );
JJ Allaire2ec40242014-09-15 09:18:39 -0400164
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};