Skip to content

Instantly share code, notes, and snippets.

@alexeagle
Last active April 16, 2017 20:29
Show Gist options
  • Save alexeagle/87a769ff627a43c9fc6f498d49b2a577 to your computer and use it in GitHub Desktop.
Save alexeagle/87a769ff627a43c9fc6f498d49b2a577 to your computer and use it in GitHub Desktop.
const gulp = require('gulp');
const format = require('gulp-clang-format');
const clangFormat = require('clang-format');
const srcsToFmt = ['{src,test}/*.{js,ts}', '*.js'];
gulp.task(
'format:enforce',
() => gulp.src(srcsToFmt).pipe(
format.checkFormat('file', clangFormat, {verbose: true, fail: true})));
gulp.task(
'format',
() => gulp.src(srcsToFmt, {base: '.'})
.pipe(format.format('file', clangFormat))
.pipe(gulp.dest('.')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment