-
Notifications
You must be signed in to change notification settings - Fork 9
/
gruntfile.js
84 lines (78 loc) · 2.29 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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-karma');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
year: new Date().getFullYear(),
jshint: {
gruntfile: 'Gruntfile.js',
tests: 'test/*.js',
src: 'src/*.js',
options: {
multistr: true,
globals: {
eqeqeq: true
}
}
},
karma: {
options: {
configFile: 'karma.conf.js',
reporters: ['progress']
},
// Watch configuration
watch: {
background: true
},
// Single-run configuration for development
single: {
singleRun: true
}
},
uglify:{
options:{
banner:'/* scopeQuerySelectorShim.js' + '\n*' + '\n* Copyright (C) <%= year %> Larry Davis' + '\n* All rights reserved.' + '\n*' + '\n* This software may be modified and distributed under the terms' + '\n* of the BSD license. See the LICENSE file for details.' + '\n*/\n'
},
expanded:{
options:{
mangle:false,
compress:false,
beautify:true,
preserveComments:true
},
files:{
'dist/scopedQuerySelectorShim.js':[ 'src/scopedQuerySelectorShim.js' ]
}
},
minified:{
files:{
'dist/scopedQuerySelectorShim.min.js':[ 'src/scopedQuerySelectorShim.js' ]
}
}
},
watchFiles: {
gruntfile: {
files: 'Gruntfile.js',
tasks: 'jshint:gruntfile'
},
src: {
files: [ 'src/**' ],
tasks: [ 'jshint:src', 'uglify', 'karma:watch:run' ]
},
unitTests: {
files: [ 'test/*.js' ],
tasks: [ 'jshint:tests', 'karma:watch:run' ]
}
}
});
// Rename watch tasks
grunt.renameTask('watch', 'watchFiles');
// Setup watch task to include Karma
grunt.registerTask('watch', [ 'karma:watch:start', 'watchFiles' ]);
// Run tests once
grunt.registerTask('test', [ 'jshint:tests', 'karma:single' ]);
// Start watching and run tests when files change
grunt.registerTask('default', [ 'jshint', 'test', 'watch' ]);
};