prettier clipboard

From their README

Alfred Prettier Clipboard 🎨

Format code in your clipboard with Prettier


Sometimes you're writing code in a textarea where you don't have plugins/extension to automatically format your code. Rather than manually formatting, you can run prettier on it with this workflow.


  • node - Node.js JavaScript runtime.
  • prettier - Opinionated Code Formatter.


  1. Install dependencies node and prettier (must be installed globally).
  2. Download the Alfred Workflow (Prettier-Clipboard.alfredworkflow).
  3. Double-click to import into Alfred (requires Powerpack).
  4. Customize prettier with workflow variable PRETTIER_OPTIONS or .prettierrc (see configuration).


prettier {parser} - Run prettier on your clipboard with selected {parser}.


Environment variables

Key Default Description
PRETTIER_OPTIONS Options to be passed to prettier command.
PRETTIER_PATH "/usr/local/bin" Where to find prettier.


To customize prettier, we can either pass options with environment variables PRETTIER_OPTIONS or create a configuration file i.e. .prettierrc.


With PRETTIER_OPTIONS we can use the CLI overrides from

Configuration file

Prettier will automatically pick up configuration files, so we can customize prettier by adding a .prettierrc file in the workflow directory or globally at ~/.prettierc.

To add .prettierrc in the workflow directory

  1. Go to Alfred workflows, find Prettier Clipboard. You can also do this by typing ?prettier in Alfred.
  2. Right-click -> Open in terminal.
  3. Create .prettierrc for example: $ echo '{ "semi": false, "trailingComma": "all" }' > .prettierrc (see for available options).

More workflows


MIT License