Firebase Hosting Cache & Gulp
const git = require('git-rev')
const data = require('gulp-data')
const pkg = require('./package.json')
const template = require('gulp-template')
gulp.task('environment', function() {
git.branch(function (branch) {
git.short(function (commit) {
console.log('Setting up configuration for', branch.toUpperCase())
const config = {
version: pkg.version, commit: commit, branch: branch
}
return gulp.src('views/index.html')
.pipe(data(() => (config)))
.pipe(template())
.pipe(gulp.dest('dist'))
})
})
})