gulp-buildinfo-replace
v1.0.6
Published
Inject version info into HTML (package.json, git commit, build info)
Downloads
1
Readme
gulp-buildinfo-replace
Inject version info into HTML (package.json, git commit, build info).
Information
Usage
Install
$ npm install gulp-buildinfo-replace --save-dev
Example
var gulp = require('gulp');
var buildInfoReplace = require('gulp-buildinfo-replace');
// Basic usage:
gulp.task('buildInfo', function(){
gulp.src('./index.html')
.pipe(buildInfoReplace({meta: true})) // Elements will be meta tags, not comments
.pipe(gulp.dest('./'));
});
Options
options.tag
Set a specific tag to insert before it.
Type: `String`
Default: `head`
Example:
.pipe(buildInfoReplace({tag: 'head'})) // Puts the information into the 'head' DOM element
options.indent
Number of spaces for indentation (for formatting).
Type: `Number`
Default: `4`
Example:
.pipe(buildInfoReplace({indent: 2}))
options.version
Places the package.json version.
Type: `Boolean`
Default: `true`
Example:
.pipe(buildInfoReplace({version: true}))
options.commit
Places the git commit.
Type: `Boolean`
Default: `false`
Example:
.pipe(buildInfoReplace({commit: true}))
options.branch
Places the git branch.
Type: `Boolean`
Default: `false`
Example:
.pipe(buildInfoReplace({branch: true}))
options.utcdate
Places the UTC formatted date.
Type: `Boolean`
Default: `false`
Example:
.pipe(buildInfoReplace({utcdate: true}))
options.buildms
Places the timestamp as milliseconds.
Type: `Boolean`
Default: `false`
Example:
.pipe(buildInfoReplace({buildms: true}))
options.meta
Places the build information as meta elements instead of comments.
Type: `Boolean`
Default: `false`
Example:
.pipe(buildInfoReplace({meta: true}))
options.gitdir
Specifies the git directory to use. Useful if git modules are being used.
Type: `String`
Default: `process.cwd()`
Example:
.pipe(buildInfoReplace({gitdir: '../project-root/submodule'}))
options.unknownCommit
The string to use when the commit cannot be found.
Type: `String`
Default: `unknown`
Example:
.pipe(buildInfoReplace({unknownCommit: 'unknown_commit'}))
options.unknownBranch
The string to use when the branch cannot be found.
Type: `String`
Default: `unknown`
Example:
.pipe(buildInfoReplace({unknownBranch: 'unknown_branch'}))