-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
84 lines (79 loc) · 2.04 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-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-express-server');
grunt.initConfig({
clean: {
dev: {
src: 'build/'
}
},
copy: {
dev: {
expand: true,
cwd: 'app/', //current working directory
src: ['*.html', 'css/*.css', 'views/**/*.html', 'images/*.jpg'],
dest: 'build/',
filter: 'isFile'
}
},
browserify: {
dev: {
options: {
transform: ['debowerify'],
debug: true
},
src: ['app/js/**/*.js'],
dest: 'build/bundle.js'
},
angulartest: {
options: {
transform: ['debowerify'],
debug: true
},
src: ['test/**/*test.js'],
dest: 'test/angular-testbundle.js'
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
}
},
express: {
options: {
port: 3000
},
dev: {
options: {
script: 'server.js'
}
}
},
watch: {
angulartest: {
files: ['app/js/**/*.js', 'app/index.html', 'app/views/**/*.html'],
tasks: ['browserify:angulartest'],
options: {
spawn:false
}
},
express: {
files: ['app/js/**/*.js', 'models/*.*', 'routes/*.*', 'app/index.html', 'app/views/**/*.html', 'app/css/*.css', 'app/views/**/*.html', 'server.js', 'models/*.js'],
tasks: ['build'],
options: {
spawn: false
}
}
}
});
grunt.registerTask('build',['clean:dev','browserify:dev', 'copy:dev']);
grunt.registerTask('test', ['browserify:angulartest','karma:unit']);
grunt.registerTask('serve', ['express:dev','watch:express']);
grunt.registerTask('default',['build','serve']); //'test'
};