gulp-prettier

6.0.0 • Public • Published

gulp-prettier

Format files with Prettier

GitHub Workflow Status npm version semantic-release

Install

npm install gulp-prettier --save-dev

Usage

import gulp from 'gulp';
import prettier from 'gulp-prettier';

function format() {
  return gulp.src('src/*.js')
    .pipe(prettier({ singleQuote: true }))
    .pipe(gulp.dest('dist'));
}

export default format;

To check whether or not your files adhere to Prettier's formatting, use prettier.check. This can be used as a validation step in CI scenarios.

import gulp from 'gulp';
import prettier from 'gulp-prettier';

function validate() {
  return gulp.src('dist/*.js')
    .pipe(prettier.check({ singleQuote: true }));
}

export default validate;

API

prettier([options])

Formats your files using Prettier.

options

Type: Object

Consult the Prettier options.

editorconfig: true can also be passed to enable EditorConfig support.

prettier.check([options])

Checks if your files have been formatted with Prettier and, if not, throws an error with a list of unformatted files. This is useful for running Prettier in CI scenarios.

options

Type: Object

Consult the Prettier options.

editorconfig: true can also be passed to enable EditorConfig support.

License

MIT © Thomas Vantuycom

Package Sidebar

Install

npm i gulp-prettier

Weekly Downloads

17,637

Version

6.0.0

License

MIT

Unpacked Size

6.83 kB

Total Files

4

Last publish

Collaborators

  • thedancingcode
  • thomasvantuycom