0.0.1 • Published 9 years ago

gulp-git-staged v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

gulp-git-staged

git-staged plugin for gulp

TODO

WIP: This gulp plugin is a work in progress.

  • Add more test for this plugin.

Usage

You can get an object stream of git staged files on git.

First, install gulp-git-staged as a development dependency:

npm install --save-dev gulp-git-staged

Then, add it to your gulpfile.js:

var gitStaged = require("gulp-git-staged");

gulp.src("./src/*.ext")
	.pipe(gitStaged())
	.on('data', function (file) {
    console.log("Staged file:", file);
  });

API

git-staged(options)

options.status

Type: String
Default: AMRC

What status mode to look for.

A = added
M = modified
R = renamed
C = copied

EXAMPLE

We use this plugin for pre-commit task.

gulp.task('pre-commit', function(done) {
	gulp.src('./**/*')
			.pipe(gitStaged())
			.pipe(jshint())
			.pipe(jsbeautifier({
					config: '.jsbeautifyrc',
					mode: 'VERIFY_AND_WRITE'
			}))
			.pipe(gulp.dest('dest'))
			.pipe(git.add());
});			

License

MIT License