To exclude files from formatting, create a `.prettierignore` file in the root of your project. `.prettierignore` uses [gitignore syntax](https://git-scm.com/docs/gitignore#_pattern_format).
It’s recommended to have a `.prettierignore` in your project! This way you can run `prettier --write .` to make sure that everything is formatted (without mangling files you don’t want, or choking on generated files). And – your editor will know which files _not_ to format!
By default prettier ignores files in version control systems directories (".git", ".jj", ".sl", ".svn" and ".hg") and `node_modules` (unless the [`--with-node-modules` CLI option](cli.md#--with-node-modules) is specified). Prettier will also follow rules specified in the ".gitignore" file if it exists in the same directory from which it is run.
A JavaScript comment of `// prettier-ignore` will exclude the next node in the abstract syntax tree from formatting.
For example:
<!-- prettier-ignore -->
```js
matrix(
1,0,0,
0,1,0,
0,0,1
)
// prettier-ignore
matrix(
1,0,0,
0,1,0,
0,0,1
)
```
will be transformed to:
```js
matrix(1,0,0,0,1,0,0,0,1);
// prettier-ignore
matrix(
1,0,0,
0,1,0,
0,0,1
)
```
## JSX
```jsx
<div>
{/* prettier-ignore */}
<spanuglyformat=''/>
</div>
```
## HTML
```html
<!-- prettier-ignore -->
<divclass="x">hello world</div>
<!-- prettier-ignore-attribute -->
<div
(mousedown)="onStart()"
(mouseup)="onEnd()"
></div>
<!-- prettier-ignore-attribute (mouseup) -->
<div
(mousedown)="onStart()"
(mouseup)="onEnd()"
></div>
```
## CSS
```css
/* prettier-ignore */
.myuglyrule
{
}
```
## Markdown
```markdown
<!-- prettier-ignore -->
Do not format this
```
### Range Ignore
_available in v1.12.0+_
This type of ignore is only allowed to be used in top-level and aimed to disable formatting for auto-generated content, e.g. [`all-contributors`](https://github.com/kentcdodds/all-contributors), [`markdown-toc`](https://github.com/jonschlinkert/markdown-toc), etc.
```markdown
<!-- prettier-ignore-start -->
<!-- SOMETHING AUTO-GENERATED BY TOOLS - START -->
**Important:** You must have a blank line before `<!-- prettier-ignore-start -->` and `<!-- prettier-ignore-end -->` for Prettier to recognize the comments.