{"id":18081318,"url":"https://github.com/hawkins/prettier-webpack-plugin","last_synced_at":"2025-08-20T04:32:54.914Z","repository":{"id":57330076,"uuid":"79923939","full_name":"hawkins/prettier-webpack-plugin","owner":"hawkins","description":"Process your Webpack dependencies with Prettier","archived":false,"fork":false,"pushed_at":"2023-04-05T08:36:26.000Z","size":203,"stargazers_count":50,"open_issues_count":9,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-09T18:24:36.701Z","etag":null,"topics":["hacktoberfest2018","javascript","prettier","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://travis-ci.org/hawkins/prettier-webpack-plugin","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hawkins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-24T15:26:29.000Z","updated_at":"2024-01-16T13:48:19.000Z","dependencies_parsed_at":"2022-08-29T04:30:10.217Z","dependency_job_id":null,"html_url":"https://github.com/hawkins/prettier-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawkins%2Fprettier-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawkins%2Fprettier-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawkins%2Fprettier-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hawkins%2Fprettier-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hawkins","download_url":"https://codeload.github.com/hawkins/prettier-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230394228,"owners_count":18218707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest2018","javascript","prettier","webpack","webpack-plugin"],"created_at":"2024-10-31T13:14:07.694Z","updated_at":"2024-12-19T07:07:03.307Z","avatar_url":"https://github.com/hawkins.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prettier Webpack Plugin\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/hawkins/prettier-webpack-plugin.svg)](https://greenkeeper.io/)\n[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors)\n\nAutomatically process your source files with [Prettier](https://github.com/jlongster/prettier) when bundling via Webpack.\n\n## How it works\n\nThis plugin reads all file dependencies in your dependency graph.\nIf a file is found with a matching extension, the file is processed by Prettier and overwritten.\n\nYou can provide options Prettier by specifying them when creating the plugin.\n\n## Looking for a loader?\n\nIt's in its early stages, but you can find a loader version of this plugin here: [prettier-webpack-loader](https://github.com/hawkins/prettier-webpack-loader)\n\n## Installation\n\n\u003e Note, for Webpack 4 support, install prettier-webpack-plugin@1. For Webpack \u003c 4, install prettier-webpack-plugin@0\n\nSimply run `npm install --save-dev prettier prettier-webpack-plugin` or `yarn add --dev prettier prettier-webpack-plugin` to install.\n\nThen, in your Webpack config files, add the lines:\n\n```JavaScript\nvar PrettierPlugin = require(\"prettier-webpack-plugin\");\n\nmodule.exports = {\n  // ... config settings here ...\n  plugins: [\n    new PrettierPlugin()\n  ],\n};\n\n```\n\n### Why?\n\nKeeping style consistent between programmers new to collaboration can be tricky.\nPrettier tackles this problem by formatting your code to fit its preferred style, which is admittedly very pretty.\nNow, your code is automatically formatted when you bundle with Webpack.\n\nPerfect for group projects bundling code on save!\n\n### Usage\n\nThe API is very simple.\nThe constructor accepts one argument, `options`, a JavaScript object which you can leverage to override any default behaviors.\nYou can specify any of [Prettier's options](https://github.com/jlongster/prettier#api) to override any of the defaults.\n\nFor the most basic example, simple add this in your `webpack.config.js`:\n\n```JavaScript\nplugins: [\n  new PrettierPlugin()\n],\n```\n\nOr, you could add options to the plugin in the form of an `Object`:\n\n```JavaScript\nplugins: [\n  new PrettierPlugin({\n    printWidth: 80,               // Specify the length of line that the printer will wrap on.\n    tabWidth: 2,                  // Specify the number of spaces per indentation-level.\n    useTabs: false,               // Indent lines with tabs instead of spaces.\n    semi: true,                   // Print semicolons at the ends of statements.\n    encoding: 'utf-8',            // Which encoding scheme to use on files\n    extensions: [ \".js\", \".ts\" ]  // Which file extensions to process\n  })\n],\n```\n\n\u003e Again, see [Prettier's options](https://github.com/jlongster/prettier#api) for a complete list of options to specify for Prettier.\n\nNote that you can specify any option for Prettier to use in this object. So, all options are assumed to be for Prettier, and will thus be passed to prettier, with the exception of three for this plugin:\n\n- `encoding` (type: `String`)\n  - The encoding scheme to use for the file.\n  -  **Default**: `utf-8`\n- `extensions` (type: `[String]`)\n  - Which file extensions to pass.\n  - **Default**: Either what your version of Prettier supports, or `[ \".css\", \".graphql\", \".js\", \".json\", \".jsx\", \".less\", \".sass\", \".scss\", \".ts\", \".tsx\", \".vue\", \".yaml\" ]`\n- `configFile` (type: `String`)\n  - Optional value to supply global config file from your project in order to avoid hardcoding values in multiple places\n  - **Default**: `.prettierrc` (from your current project directory)\n\n### Testing\n\n`npm run test` or `yarn run test` will show you how tests are going currently.\n\nThese tests can also serve as primitive examples for configuring Prettier Webpack Plugin.\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n| [\u003cimg src=\"https://avatars3.githubusercontent.com/u/9123458?v=3\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJosh Hawkins\u003c/b\u003e\u003c/sub\u003e](https://hawkins.is/)\u003cbr /\u003e[💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=hawkins \"Code\") [📖](https://github.com/hawkins/prettier-webpack-plugin/commits?author=hawkins \"Documentation\") [💡](#example-hawkins \"Examples\") [⚠️](https://github.com/hawkins/prettier-webpack-plugin/commits?author=hawkins \"Tests\") | [\u003cimg src=\"https://avatars0.githubusercontent.com/u/655838?v=3\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eErwann Mest\u003c/b\u003e\u003c/sub\u003e](http://kud.io)\u003cbr /\u003e[📖](https://github.com/hawkins/prettier-webpack-plugin/commits?author=kud \"Documentation\") | [\u003cimg src=\"https://avatars2.githubusercontent.com/u/15572427?v=3\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eEduardo Sganzerla\u003c/b\u003e\u003c/sub\u003e](http://esganzerla.com.br)\u003cbr /\u003e[💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=esganzerla \"Code\") [📖](https://github.com/hawkins/prettier-webpack-plugin/commits?author=esganzerla \"Documentation\") [⚠️](https://github.com/hawkins/prettier-webpack-plugin/commits?author=esganzerla \"Tests\") | [\u003cimg src=\"https://avatars2.githubusercontent.com/u/15929189?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003erkilgore-meta\u003c/b\u003e\u003c/sub\u003e](https://github.com/rkilgore-meta)\u003cbr /\u003e[💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=rkilgore-meta \"Code\") [🤔](#ideas-rkilgore-meta \"Ideas, Planning, \u0026 Feedback\") [⚠️](https://github.com/hawkins/prettier-webpack-plugin/commits?author=rkilgore-meta \"Tests\") | [\u003cimg src=\"https://avatars1.githubusercontent.com/u/830470?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJacob\u003c/b\u003e\u003c/sub\u003e](http://jacob.wtf)\u003cbr /\u003e[🤔](#ideas-jacobbuck \"Ideas, Planning, \u0026 Feedback\") | [\u003cimg src=\"https://avatars1.githubusercontent.com/u/1934760?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJason Salzman\u003c/b\u003e\u003c/sub\u003e](https://github.com/jasonsalzman)\u003cbr /\u003e[💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=jasonsalzman \"Code\") [📖](https://github.com/hawkins/prettier-webpack-plugin/commits?author=jasonsalzman \"Documentation\") [🤔](#ideas-jasonsalzman \"Ideas, Planning, \u0026 Feedback\") [⚠️](https://github.com/hawkins/prettier-webpack-plugin/commits?author=jasonsalzman \"Tests\") | [\u003cimg src=\"https://avatars3.githubusercontent.com/u/5408269?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003epastelInc\u003c/b\u003e\u003c/sub\u003e](https://github.com/pastelInc)\u003cbr /\u003e[💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=pastelInc \"Code\") |\n| :---: | :---: | :---: | :---: | :---: | :---: | :---: |\n| [\u003cimg src=\"https://avatars3.githubusercontent.com/u/2951704?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNicolas Beauvais\u003c/b\u003e\u003c/sub\u003e](http://nicolas-beauvais.com)\u003cbr /\u003e[💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=nicolasbeauvais \"Code\") | [\u003cimg src=\"https://avatars0.githubusercontent.com/u/426452?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAlejandro Sanchez\u003c/b\u003e\u003c/sub\u003e](https://alesanchezr.com)\u003cbr /\u003e[🐛](https://github.com/hawkins/prettier-webpack-plugin/issues?q=author%3Aalesanchezr \"Bug reports\") [💻](https://github.com/hawkins/prettier-webpack-plugin/commits?author=alesanchezr \"Code\") |\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhawkins%2Fprettier-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhawkins%2Fprettier-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhawkins%2Fprettier-webpack-plugin/lists"}