Skip to content

rbelmega/gulp-ng-prettier

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gulp Prettier Build Status GitHub version npm version

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-ng-prettier');

gulp.task('default', () => {
	gulp.src('*.js')
	.pipe(prettier({ parser: 'flow' }))
	.pipe(gulp.dest('./'))
});

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: 100,
  
    // Number of spaces it should use per tab
    tabWidth: 2,
  
    // Use tabs instead of spaces
    useTabs: false,
  
    // Specify which parser to use.
    parser: 'flow',
  
    // If true, will use single instead of double quotes
    singleQuote: false,
  
    // Controls the printing of trailing commas wherever possible
    trailingComma: 'none',
  
    // Controls the printing of spaces inside array and objects
    bracketSpacing: true,
  
    // Print semicolons at the ends of statements
    semi: true
}

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%