This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Use it in your editor
CP Clermont edited this page May 27, 2022
·
5 revisions
You have two options:
- Use it from the Shopify Liquid extension
- Use it with the Prettier 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.json
configuration 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 >
-
Install
prettier
and the@shopify/prettier-plugin-liquid
packages in your repo.yarn add -D prettier @shopify/prettier-plugin-liquid
Note: 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 >
TODO.