-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
110 lines (106 loc) · 2.49 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
102
103
104
105
106
107
108
109
110
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
srcPath: 'src',
buildPath: 'build',
distPath: 'dist',
moduleName: 'notifications',
moduleFile: '<%= moduleName %>.js',
moduleMinName: '<%= moduleName %>.min',
moduleMinFile: '<%= moduleMinName %>.js',
mainName: 'index',
mainFile: '<%= mainName %>.js',
bundlePath: 'build',
browserifyDebug: '<%= grunt.config.get("browserifyDebug") %>',
destPath: '<%= grunt.config.get("destPath") %>',
config: {
dev: {
options: {
variables: {
browserifyDebug: true,
destPath: 'build'
}
}
},
dist: {
options: {
variables: {
browserifyDebug: false,
destPath: 'dist'
}
}
}
},
browserify: {
bundle: {
src: '<%= srcPath %>/<%= mainFile %>',
dest: '<%= destPath %>/<%= moduleFile %>',
options: {
browserifyOptions: {
debug: '<%= browserifyDebug %>'
}
}
}
},
uglify: {
dist: {
files: {
'<%= destPath %>/<%= moduleFile %>': ['<%= destPath %>/<%= moduleFile %>']
}
}
},
clean: {
dist: {
src: ['dist']
},
build: {
src: ['build']
}
},
connect: {
server: {
options: {
port: 9000
},
},
},
watch: {
html: {
files: ['**/*.html'],
options: {
livereload: true,
},
},
js: {
files: ['src/**/*.js'],
options: {
livereload: true
},
tasks: ['dev']
}
},
bump: {
options: {
files: ['package.json', 'bower.json'],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['-a'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
pushTo: 'origin',
push: true
}
}
});
// Default task(s).
grunt.registerTask('default', ['dev']);
grunt.registerTask('common', ['browserify:bundle']);
grunt.registerTask('dev', ['config:dev', 'common']);
grunt.registerTask('server', ['dev', 'connect:server', 'watch']);
grunt.registerTask('dist', ['config:dist', 'common', 'uglify:dist']);
grunt.registerTask('release', ['dist', 'bump']);
};