Merge "[Promise] Fix bug opening the json result file" into stable/colorado
[functest.git] / docs / com / Gruntfile.js
1 /* global module:false */
2 module.exports = function(grunt) {
3         var port = grunt.option('port') || 8000;
4         var base = grunt.option('base') || '.';
5
6         // Project configuration
7         grunt.initConfig({
8                 pkg: grunt.file.readJSON('package.json'),
9                 meta: {
10                         banner:
11                                 '/*!\n' +
12                                 ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
13                                 ' * http://lab.hakim.se/reveal-js\n' +
14                                 ' * MIT licensed\n' +
15                                 ' *\n' +
16                                 ' * Copyright (C) 2015 Hakim El Hattab, http://hakim.se\n' +
17                                 ' */'
18                 },
19
20                 qunit: {
21                         files: [ 'test/*.html' ]
22                 },
23
24                 uglify: {
25                         options: {
26                                 banner: '<%= meta.banner %>\n'
27                         },
28                         build: {
29                                 src: 'js/reveal.js',
30                                 dest: 'js/reveal.min.js'
31                         }
32                 },
33
34                 sass: {
35                         core: {
36                                 files: {
37                                         'css/reveal.css': 'css/reveal.scss',
38                                 }
39                         },
40                         themes: {
41                                 files: [
42                                         {
43                                                 expand: true,
44                                                 cwd: 'css/theme/source',
45                                                 src: ['*.scss'],
46                                                 dest: 'css/theme',
47                                                 ext: '.css'
48                                         }
49                                 ]
50                         }
51                 },
52
53                 autoprefixer: {
54                         dist: {
55                                 src: 'css/reveal.css'
56                         }
57                 },
58
59                 cssmin: {
60                         compress: {
61                                 files: {
62                                         'css/reveal.min.css': [ 'css/reveal.css' ]
63                                 }
64                         }
65                 },
66
67                 jshint: {
68                         options: {
69                                 curly: false,
70                                 eqeqeq: true,
71                                 immed: true,
72                                 latedef: true,
73                                 newcap: true,
74                                 noarg: true,
75                                 sub: true,
76                                 undef: true,
77                                 eqnull: true,
78                                 browser: true,
79                                 expr: true,
80                                 globals: {
81                                         head: false,
82                                         module: false,
83                                         console: false,
84                                         unescape: false,
85                                         define: false,
86                                         exports: false
87                                 }
88                         },
89                         files: [ 'Gruntfile.js', 'js/reveal.js' ]
90                 },
91
92                 connect: {
93                         server: {
94                                 options: {
95                                         port: port,
96                                         base: base,
97                                         livereload: true,
98                                         open: true
99                                 }
100                         }
101                 },
102
103                 zip: {
104                         'reveal-js-presentation.zip': [
105                                 'index.html',
106                                 'css/**',
107                                 'js/**',
108                                 'lib/**',
109                                 'images/**',
110                                 'plugin/**'
111                         ]
112                 },
113
114                 watch: {
115                         options: {
116                                 livereload: true
117                         },
118                         js: {
119                                 files: [ 'Gruntfile.js', 'js/reveal.js' ],
120                                 tasks: 'js'
121                         },
122                         theme: {
123                                 files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
124                                 tasks: 'css-themes'
125                         },
126                         css: {
127                                 files: [ 'css/reveal.scss' ],
128                                 tasks: 'css-core'
129                         },
130                         html: {
131                                 files: [ 'index.html']
132                         }
133                 }
134
135         });
136
137         // Dependencies
138         grunt.loadNpmTasks( 'grunt-contrib-qunit' );
139         grunt.loadNpmTasks( 'grunt-contrib-jshint' );
140         grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
141         grunt.loadNpmTasks( 'grunt-contrib-uglify' );
142         grunt.loadNpmTasks( 'grunt-contrib-watch' );
143         grunt.loadNpmTasks( 'grunt-sass' );
144         grunt.loadNpmTasks( 'grunt-contrib-connect' );
145         grunt.loadNpmTasks( 'grunt-autoprefixer' );
146         grunt.loadNpmTasks( 'grunt-zip' );
147
148         // Default task
149         grunt.registerTask( 'default', [ 'css', 'js' ] );
150
151         // JS task
152         grunt.registerTask( 'js', [ 'jshint', 'uglify', 'qunit' ] );
153
154         // Theme CSS
155         grunt.registerTask( 'css-themes', [ 'sass:themes' ] );
156
157         // Core framework CSS
158         grunt.registerTask( 'css-core', [ 'sass:core', 'autoprefixer', 'cssmin' ] );
159
160         // All CSS
161         grunt.registerTask( 'css', [ 'sass', 'autoprefixer', 'cssmin' ] );
162
163         // Package presentation to archive
164         grunt.registerTask( 'package', [ 'default', 'zip' ] );
165
166         // Serve presentation locally
167         grunt.registerTask( 'serve', [ 'connect', 'watch' ] );
168
169         // Run tests
170         grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
171
172 };