Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Use it in the browser

CP Clermont edited this page May 26, 2022 · 2 revisions

This package exposes a standalone.js that can be used alongside Prettier's own standalone.js to make the Liquid plugin work in browsers without a compile step.

With a npm CDN

First, grab both standalone scripts from an npm CDN like unpkg:

<script src="https://unpkg.com/prettier/standalone.js"></script>
<script src="https://unpkg.com/@shopify/prettier-plugin-liquid/standalone.js"></script>

Then use Prettier with Liquid, just like this:

prettier.format(YOUR_CODE, {
  plugins: [prettierPluginLiquid],
  parser: 'liquid-html',
});
Clone this wiki locally