gulp-prettiest

1.0.0 • Public • Published

Gulp Prettiest Build Status

A Gulp plugin which allows the users to use Prettier.

Prettier is an opinionated JavaScript formatter inspired by refmt with advanced support for language features from ES2017, JSX, and Flow. It removes all original styling and ensures that all outputted JavaScript conforms to a consistent style. (See this blog post)

Usage

Simply pipe the input, and pass in arguments that you would to the regular format function.

const gulp = require('gulp'),
  prettier = require('gulp-prettiest');
 
gulp.task('default', () => {
    gulp.src('*.js')
    .pipe(prettier({useFlowParser: true}))
    .pipe(gulp.dest('./dist'))
});

Please consult the Prettier README to know the possible optional arguments. At the time of this writing, these are the following optional arguments.

{
  // Fit code within this line limit
  printWidth: 80,
 
  // Number of spaces it should use per tab
  tabWidth: 2,
 
  // Use the flow parser instead of babylon
  useFlowParser: false,
 
  // If true, will use single instead of double quotes
  singleQuote: false,
 
  // Controls the printing of trailing commas wherever possible
  trailingComma: false,
 
  // Controls the printing of spaces inside array and objects
  bracketSpacing: true
}

License

MIT License

Package Sidebar

Install

npm i gulp-prettiest

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ntucker