Last active
August 29, 2015 14:10
-
-
Save mcranston18/7c988c8600fb44b397d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var git = require('gulp-git'); | |
var inject = require('inject-string'); | |
var q = require('q'); | |
var getHash = function() { | |
var deferred = q.defer(); | |
$.git.revParse({args:'--short HEAD'}, function (err, hash) { | |
deferred.resolve(hash); | |
}); | |
return deferred.promise; | |
}; | |
gulp.task('html', function () { | |
getHash().then(function(data) { | |
return data; | |
}).then(function(hash) { | |
return gulp.src('app/index.html') | |
.pipe(inject.append(hash)) | |
.pipe(gulp.dest('dist')) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment