npm.io
1.0.8 • Published 10 years ago

gulp-format

Licence
Apache-2.0
Version
1.0.8
Deps
3
Vulns
0
Weekly
0

gulp-format

Gulp plugin to format code as properly formatted, according to clang-format.

Usage

Sample gulpfile.js:

var format = require('gulp-format');
gulp.task('check-format', function() {
  return gulp.src('*.js')
	.pipe(format.check());
});
gulp.task('format',function(){
  return gulp.src('*.js')
  .pipe(format());
});

Options

The check() function accepts an optional parameter indicating the style to use. By default, it applies the "Google" style.

The parameter is passed to the -style argument of clang-format. See the docs here: http://clang.llvm.org/docs/ClangFormatStyleOptions.html

The recommended value is the string 'file', this means that clang-format will look for a .clang-format file in your repository. This allows you to keep the formatting consistent with other developers.