Setup your Shopify theme
Once the backend app is intalled (see previous step, Setup your Gadget app), you can now add the frontend part of Brush into your Shopify theme.
This guide assumes you already know how to develop a theme for Shopify and that your local development environment is working.
Install Brush
Section titled “Install Brush”- From your Shopify theme folder, run
npm create brush@latest - Choose “Frontend” and continue
- Use
.for the “In which relative directory to install?” question and let the Brush installer run. - Add this line to your theme layout to load the automatically generated
brush.jsasset file
<script src="{{ 'brush.js' | asset_url }}" type="module"></script>
- Get ready for development by running
shopify theme dev --store [YOUR_STORE]and, only then,cd ./brushfollowed bynpm run dev.
⚠️ Always make sure to run
shopify theme devfrom your theme main directory before runningnpm run devfrom the./brushdirectory to make sure that Shopify watches changes in your Brush frontend app and updates the./assets/brush.jsfile accordingly.