-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
90 lines (80 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
/*global module*/
module.exports = function (grunt) {
'use strict';
grunt.initConfig({
karma: {
unit: {
configFile: 'karma.conf.js',
background: true
},
travis: {
configFile: 'karma.conf.js',
singleRun: true,
browsers: ['Firefox']
}
},
jshint: {
all: ['js/*.js', 'test/*.js', 'karma.conf.js', 'Gruntfile.js']
},
concat: {
options: {
separator: ';' //separates scripts
},
dist: {
src: ['js/*.js', 'lib/**/*.js'],
dest: 'bin/script.js'
}
},
uglify: {
js: {
files: {
'bin/script.js': ['bin/script.js'] //save over the newly created script
}
}
},
'string-replace': {
inline: {
files: {
'index.htm': 'index.htm'
},
options: {
replacements: [
{
pattern: '<!--start PROD imports',
replacement: '<!--start PROD imports-->'
},
{
pattern: 'end PROD imports-->',
replacement: '<!--end PROD imports-->'
},
{
pattern: '<!--start DEV imports-->',
replacement: '<!--start DEV imports'
},
{
pattern: '<!--end DEV imports-->',
replacement: 'end DEV imports-->'
}
]
}
}
},
watch: {
karma: {
files: ['js/*.js', 'test/*.js', 'lib/*.js'],
tasks: ['karma:unit:run']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-karma');
grunt.registerTask('devmode', ['karma:unit', 'watch']);
// Tasks Travis will run
grunt.registerTask('test', ['karma:travis']);
grunt.registerTask('development', ['jshint']);
grunt.registerTask('production', ['jshint', 'concat', 'uglify', 'string-replace']);
};