Use it in your editor - Shopify/prettier-plugin-liquid GitHub Wiki
Contents
Visual Studio Code
You have two options:
- Use it from the Shopify Liquid extension
- Use it with the Prettier extension
From the Shopify Liquid extension
The code formatter is baked into the extension. But, since it is still in dev preview, it is opt-in.
- Install the Shopify Liquid VS Code extension.
- In your
settings.jsonconfiguration file (Command palette >Preferences: Open Settings (JSON)), add the following settings to turn on the feature.{ "shopifyLiquid.formatterDevPreview": true, }- (Optional) If you'd like to turn on format-on-save, add the following:
{ "shopifyLiquid.formatterDevPreview": true, "[liquid]": { "editor.defaultFormatter": "Shopify.theme-check-vscode", "editor.formatOnSave": true }, }
- (Optional) If you'd like to turn on format-on-save, add the following:
- From any Liquid file, you can
Format Document:- Right click >
Format Document - Command palette (
⌘+⇧+p) >Format Document - Press a keyboard shortcut
- Right click >
From the Prettier extension
-
Install
prettierand the@shopify/prettier-plugin-liquidpackages in your repo.yarn add -D prettier @shopify/prettier-plugin-liquidNote: the installation must be local to the repository (cannot be a global install).
-
Install the Prettier VS Code extension.
-
From any Liquid file, you can
Format Document:- Right click >
Format Document - Command palette (
⌘+⇧+p) >Format Document - Press a keyboard shortcut
- Right click >
Other editors
TODO.