Files
test-repo/docs/watching-files.md
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
451 B
Markdown
Raw Normal View History

2017-11-07 14:39:07 +11:00
---
id: watching-files
title: Watching For Changes
---
You can have Prettier watch for changes from the command line by using [onchange](https://www.npmjs.com/package/onchange). For example:
2017-11-07 14:39:07 +11:00
2020-04-03 18:44:03 +08:00
```bash
2020-08-21 09:11:59 +08:00
npx onchange "**/*" -- npx prettier --write --ignore-unknown {{changed}}
2017-11-07 14:39:07 +11:00
```
Or add the following to your `package.json`:
2017-11-07 14:39:07 +11:00
```json
2020-04-03 18:44:03 +08:00
{
2017-11-07 14:39:07 +11:00
"scripts": {
2020-08-21 09:11:59 +08:00
"prettier-watch": "onchange \"**/*\" -- prettier --write --ignore-unknown {{changed}}"
2020-04-03 18:44:03 +08:00
}
}
2017-11-07 14:39:07 +11:00
```