I need to display git revision on my angular2 application\'s about page. The project is based on angular-cli.
How can build be extended so git revision is put for exampl
Use gulp task using gulp-replace and git-rev-sync to add the hash and branch on build :
1) Create the gulp task
var gulp = require('gulp'),
replace = require('gulp-replace'),
git = require('git-rev-sync'),
gulp.task('git', function () {
gulp.src('src/index.html')
.pipe(replace('{{git-branch}}', git.branch()))
.pipe(replace('{{git-hash}}', git.short()))
.pipe(gulp.dest('src/'))
});
// Build Tasks
gulp.task('build', ['git']);
2) Add the following code to index.html :
{{git-branch}}@{{git-hash}}
3) Run
gulp build