mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 08:12:10 +08:00
Modularize grunt tasks
This commit is contained in:
38
tasks/build_task.js
Normal file
38
tasks/build_task.js
Normal file
@ -0,0 +1,38 @@
|
||||
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', {
|
||||
src: '<%= destDir %>/app/components/require.config.js',
|
||||
dest: '<%= destDir %>/app/components/require.config.js',
|
||||
options: {
|
||||
replacements: [
|
||||
{
|
||||
pattern: /(?:^|\/\/)(.*)@REV@/,
|
||||
replacement: '$1'+desc.object
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
grunt.task.run('string-replace:config');
|
||||
});
|
||||
grunt.task.run('git-describe');
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user