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