Skip to content

Instantly share code, notes, and snippets.

@legege
Created December 1, 2015 18:40
Show Gist options
  • Save legege/71055dd04b0c89f51d8f to your computer and use it in GitHub Desktop.
Save legege/71055dd04b0c89f51d8f to your computer and use it in GitHub Desktop.
Generate chcp.json and chcp.manifest with Gulp
// generate chcp.manifest
gulp.task('chcp-manifest', ['index'], function() {
return gulp.src(['**/*', '!chcp.*'], { cwd: path.join(targetDir, '') })
.pipe(plugins.buster({ fileName: 'chcp.manifest', algo: 'md5', transform: function(hashes) {
var transformed = [];
for (var file in hashes) {
transformed.push({ file: file, hash: hashes[file] });
}
return transformed;
}}))
.pipe(gulp.dest(targetDir));
});
// take care of changing version in chcp.json
gulp.task('chcp-config', ['index'], function() {
return gulp.src('app/chcp.json')
.pipe(plugins.replace('${release}', new Date().toISOString()))
.pipe(gulp.dest(targetDir))
.on('error', errorHandler);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment