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

20 lines
447 B
Markdown
Raw Normal View History

2017-11-07 14:39:07 +11:00
---
id: watching-files
title: Watching For Changes
---
If you prefer to have prettier watch for changes from the command line you can use a package like [onchange](https://www.npmjs.com/package/onchange). For example:
2020-04-03 18:44:03 +08:00
```bash
2017-11-07 14:39:07 +11:00
npx onchange '**/*.js' -- npx prettier --write {{changed}}
```
or add the following to your `package.json`
```json
2020-04-03 18:44:03 +08:00
{
2017-11-07 14:39:07 +11:00
"scripts": {
"prettier-watch": "onchange '**/*.js' -- prettier --write {{changed}}"
2020-04-03 18:44:03 +08:00
}
}
2017-11-07 14:39:07 +11:00
```