-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
101 lines (85 loc) · 1.74 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
module.exports = function(grunt) {
// Load Grunt tasks declared in the package.json file
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
// Metadata
pkg: grunt.file.readJSON('package.json'),
// Install dependencies
bower: {
install: {
options: {
cleanTargetDir: true,
cleanBowerDir: true
}
}
},
karma: {
options: {
configFile: 'karma.conf.js'
},
continuous: {
singleRun: true
},
dev: {
background: true
}
},
// Remove build and dist directory
clean: ['build', 'dist'],
watch: {
scripts: {
files: [ 'src/**/*.js', 'examples/*.html' ],
tasks: ['uglify']
},
tests: {
files: [ 'tests/**/*.js', 'tests/*.html' ],
tasks: ['karma:dev:run']
},
options: {
spawn: false
}
},
jshint: {
all: [
'Gruntfile.js',
'karma.conf.js',
'src/*.js',
],
options: {
jshintrc: '.jshintrc'
}
},
uglify: {
dist: {
files: {
'dist/formbouncer.min.js': ['src/formbouncer.js'],
'dist/jquery.formbouncer.min.js': ['src/formbouncer.js', 'src/jquery.formbouncer.js']
}
}
},
connect: {
options: {
port: 9011,
hostname: "0.0.0.0",
base: './'
},
dev: {
options: {
middleware: function (connect, options) {
return [
require('connect-livereload')(),
// Serve statics
connect.static(options.base),
// Directory listing
connect.directory(options.base)
];
}
}
}
}
});
grunt.registerTask('test', ['karma:continuous']);
grunt.registerTask('dist', ['jshint', 'clean', 'uglify']);
grunt.registerTask('dev', ['karma:dev', 'dist', 'connect:dev', 'watch']);
grunt.registerTask('default', ['dev']);
};