Use it as a pre commit hook - Shopify/prettier-plugin-liquid GitHub Wiki

What's a pre-commit hook?

You might work in a big team and would like to make it super easy for everyone to maintain a code style.

Setting up a pre-commit hook will make it so prettier will run on files that were changed before a commit is even made.

Even if your coworkers haven't setup prettier in their editor.

How do I set them up?

  1. Add @shopify/prettier-plugin-liquid as a dependency of your project.

    # npm way
    npm install -D prettier @shopify/prettier-plugin-liquid
    
    # yarn way
    yarn add -D prettier @shopify/prettier-plugin-liquid
    
  2. Follow the official instructions from prettier on how to setup a pre-commit hook.