-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
75 lines (61 loc) · 1.53 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
function getPluginBanner () {
var pluginBanner = '';
pluginBanner += '/**\n';
pluginBanner += ' * Plugin: TimeKeeper\n';
pluginBanner += ' * Author: Sundarasan Natarajan\n';
pluginBanner += ' * GIT: https://github.com/Sujsun/timekeeper.git\n';
pluginBanner += ' * Version: 0.0.2\n';
pluginBanner += ' */\n';
return pluginBanner;
}
var pluginBanner = getPluginBanner();
module.exports = function(grunt) {
grunt.initConfig({
copy: {
dist: {
files: { 'dist/timekeeper.js': './index.js' }
},
public_dist: {
files: [
{ expand: true, src: ['dist/*'], dest: 'public/', filter: 'isFile' },
],
},
},
uglify: {
dist: {
options: {
banner: pluginBanner
},
files: {
'dist/timekeeper.min.js': ['dist/timekeeper.js']
}
}
},
watch: {
dist: {
files: ['dist/timekeeper.js', './index.js'],
tasks: ['build']
},
},
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('start', 'My start task description', function() {
grunt.util.spawn({
cmd: 'npm',
args: ['start']
});
console.log('Server running at http://127.0.0.1:8989 (http://localhost:8989)');
grunt.task.run('watch');
});
grunt.registerTask('build', [
'copy:dist',
'uglify',
'copy:public_dist',
]);
grunt.registerTask('default', [
'build',
'start',
]);
};