Skip to content

Instantly share code, notes, and snippets.

@mcranston18
Last active August 4, 2022 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcranston18/8a0d23ead646df46f1f4 to your computer and use it in GitHub Desktop.
Save mcranston18/8a0d23ead646df46f1f4 to your computer and use it in GitHub Desktop.
var git = require('gulp-git');
var inject = require('inject-string');
// This successfully returns my git hash
gulp.task('hash', function() {
git.revParse({args:'--short HEAD'}, function (err, hash) {
return hash;
});)
})
// How do I inject the return value of the hash task into the inject.append block?
gulp.task('html', function () {
return gulp.src('app/index.html')
.pipe(inject.append('append git hash here!'))
.pipe(gulp.dest('dist'))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment