Shopify Apps
The Problem
Because of our workflow, we are treating what is in the git repo as the source of truth (as we should). Whenever you push a theme to Shopify, it ensures that the deployed theme stays in sync with what you have locally. This means that every file you have will be pushed to the server and every file you don't have will be removed from the server.
The problem that this leads to is when an App gets installed to the store and it injects files into the theme, they will be removed the next time someone pushes changes to Shopify. But we can't just add the files to the git repo, as they may change without our knowledge when an app updates, and we could accidentally override an app's updated files with an earlier version that had been checked into the repo.
The Fix
The correct way out of this mess is to fully ignore any app files in the .shopifyignore file. The tool will then not
pull down any app files to your local machine, and not delete them from the remote server if they are missing locally.
How
This process works best when your working directory is clean, so make sure you commit or discard any changes in git before continuing.
First make sure that the Shopify App in question is installed.
Next, run shopify theme pull --live to pull down the production theme. It should bring extra files with it, that you
can see in git status. For instance, the Judge.me app adds (at time of this writing):
sections/judgeme_carousel_section.liquidsnippets/judgme_all_reviews.liquidsnippets/judgeme_core.liquidsnippets/judgeme_widgets.liquid
Your goal is to find a glob pattern that encompases these files and nothing more. In this case, a good pattern is:
*judgeme_*
Once a pattern is created, create/update the .shopifyignore in the root of the project with this pattern, then delete
the app files.
If you pull the live theme down again, you should not receive any of the files that were injected. Pushing the theme should also not delete the files from the server, which you can check by editing the theme's code in the Shopify Admin Dashboard.