forked from stoffeastrom/touche
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntFile.js
122 lines (115 loc) · 2.6 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*global require, module*/
var cp = require('child_process');
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner: '/*! Touché - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'* https://github.com/stoffeastrom/touche/\n' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> ' +
'Christoffer Åström, Andrée Hansson; Licensed MIT */' + '\n'
},
jshint: {
all: [
"GruntFile.js",
"lib/*/*.js",
"test/*.js"
],
options: {
jshintrc: ".jshintrc"
}
},
mocha: {
all: {
src: ['test/index.html'],
options: {
run: true,
ignoreLeaks: false
}
}
},
concat: {
options: {
banner: '<%= meta.banner %>'
},
core: {
src: [
'lib/core/augment.js',
'lib/core/touche.js',
'lib/core/util.js',
'lib/core/cache.js',
'lib/core/flow-handler.js',
'lib/core/gesture-handler.js',
'lib/core/super-handler.js',
'lib/core/gesture.js',
'lib/core/binder.js',
'lib/core/point.js',
'lib/core/rect.js',
'lib/core/request-animation-frame.js'
],
dest: 'dist/touche.core.js'
},
all: {
src: [
'<%= concat.core.src %>',
'lib/gestures/*.js'
],
dest: 'dist/touche.js'
},
light: {
src: [
'<%= concat.core.src %>',
'lib/gestures/tap.js',
'lib/gestures/doubletap.js',
'lib/gestures/longtap.js',
'lib/gestures/swipe.js'
],
dest: 'dist/touche.light.js'
}
},
uglify: {
options: {
banner: '<%= meta.banner %>'
},
core: {
src: [
'<%= concat.core.dest %>'
],
dest: 'dist/touche.core.min.js'
},
all: {
src: [
'<%= concat.all.dest %>'
],
dest: 'dist/touche.min.js'
},
light: {
src: [
'<%= concat.light.dest %>'
],
dest: 'dist/touche.light.min.js'
}
},
devserver: {server:{}},
watch: {
files: ['<%= jshint.all %>'],
tasks: ['jshint']
}
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-mocha");
grunt.loadNpmTasks("grunt-devserver");
// Documentation generation, requires "jsdoc" to be in path
grunt.registerTask('docs', 'Generate documentation', function() {
var done = this.async();
grunt.log.writeln('Generating documentation to docs/...');
cp.exec('jsdoc -d docs -r lib/', done);
});
grunt.registerTask("test", "mocha");
// Default task.
grunt.registerTask("default", ["jshint", "test", "concat", "uglify"]);
};