prettier/editors/jetbrains/README.md

19 lines
1.0 KiB
Markdown
Raw Normal View History

### Configure External Tool
Go to *File | Settings | Tools | External Tools* for Windows and Linux or *WebStorm | Preferences | Tools | External Tools* for OS X and click **+** to add a new tool. Lets name it **Prettify**.
In **Program** set `prettier`
In **Parameters** set `--write [other opts] $FilePathRelativeToProjectRoot$`
In **Working directory** set `$ProjectFileDir$`
![With `prettier`](https://github.com/jlongster/prettier/tree/master/editors/jetbrains/with-prettier.png "With Prettier")
If on the other hand you have `prettier` installed locally, replace the **Program** with `./node_modules/.bin/prettier` (on OS X and Linux) or `.\node_modules\.bin\prettier.cmd` (on Windows).
### Configure Keymap
Now when you setup **Extarnal Tool** I guess you what to add hotkey for it. Go to *File | Settings | Keymap* for Windows and Linux *WebStorm | Preferences | Keymap* and type external tool name in search box.
See [this documentation](https://www.jetbrains.com/help/webstorm/configuring-keyboard-shortcuts.html) about configuring keyboard shortcuts.