-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·79 lines (76 loc) · 1.59 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*jshint undef:false*/
module.exports = function(grunt) {
// Load task deps
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-jsdoc-to-markdown');
// Configure
var
pkg = grunt.file.readJSON('package.json'),
files = [
'src/header.frag.js',
'src/main.js',
'src/footer.frag.js'
],
dir = {
src: 'src',
dist: 'dist',
test: 'test'
},
config = {
pkg:pkg, files:files, dir:dir,
uglify : {
unminified : {
options: {
banner:grunt.file.read('src/header.frag'),
footer:grunt.file.read('src/footer.frag'),
preserveComments:true,
mangle:false,
compress:false,
beautify:true
},
files: {
'<%= dir.dist %>/distract.js': files
}
},
minified : {
options: {
banner:grunt.file.read('src/header.frag'),
footer:grunt.file.read('src/footer.frag'),
report:'gzip',
preserveComments:false,
mangle:true,
compress:true,
beautify:false
},
files: {
'<%= dir.dist %>/distract.min.js': files
}
}
},
jsdoc2md: {
oneOutputFile: {
options: {
index: true
},
src: "src/main.js",
dest: "dist/docs.md"
}
},
clean: {
all: [dir.dist]
},
watch: {
js: {
files : files.concat('<%= dir.test %>/**/*'),
tasks : 'release'
}
}
};
// Initialize
grunt.initConfig(config);
// Export tasks
grunt.registerTask('release', ['clean', 'uglify', 'jsdoc2md']);
grunt.registerTask('default', ['release']);
};