forked from taskrabbit/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_task.js
43 lines (41 loc) · 1.21 KB
/
build_task.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
module.exports = function(grunt) {
// Concat and Minify the src directory into dist
grunt.registerTask('build', [
'jshint:source',
'clean:on_start',
'less:dist',
'copy:everything_but_less_to_temp',
'htmlmin:build',
'cssmin:build',
'ngmin:build',
'requirejs:build',
'clean:temp',
'build:write_revision',
'uglify:dest'
]);
// run a string replacement on the require config, using the latest revision number as the cache buster
grunt.registerTask('build:write_revision', function() {
grunt.event.once('git-describe', function (desc) {
grunt.config('string-replace.config', {
files: {
'<%= destDir %>/app/components/require.config.js': '<%= destDir %>/app/components/require.config.js',
'<%= destDir %>/app/app.js': '<%= destDir %>/app/app.js'
},
options: {
replacements: [
{
pattern: /(?:^|\/\/)(.*)@REV@/,
replacement: '$1'+desc.object
},
{
pattern: /@REV@/,
replacement: desc.object
}
]
}
});
grunt.task.run('string-replace:config');
});
grunt.task.run('git-describe');
});
};