Re: Wildcards in the Shopify CLI --ignore flag

Wildcards in the Shopify CLI --ignore flag

James_Wolff
Shopify Partner
2 0 3

I'm trying to push to my theme without overriding .json files used in Themes 2.0 templates.

According to the documentation (https://shopify.dev/themes/tools/cli#excluding-files-from-shopify-cli) Shopify CLI's "shopify theme push" command supports an "--ignore" flag and that can ignore files or patterns. I've found that ignoring specific files is working as intended such as:

shopify theme push --ignore "templates/collection.name.json"

But ignoring patterns such as wildcards which the documentation claims to support is not working such as:

shopify theme push --ignore "templates/*.json"
or
shopify theme push --ignore "templates/collection.*.json"

Can someone please let me know if wildcards are supported in the --ignore flag and if I'm writing the command incorrectly, or if they are not supported and I'm misinterpreting this functionality.

Replies 3 (3)

davidhollenbeck
Shopify Partner
22 0 6

Same issue here. I had a couple custom scripts that worked until maybe a month ago

 

"shopify-pull-json": "shopify theme pull --nodelete --ignore styles/* --ignore *.liquid --ignore node_modules/* --ignore assets/* --ignore .vscode/*",
"shopify-safe-push": "shopify theme push --nodelete --ignore styles/* --ignore *.json --ignore node_modules/* --ignore .vscode/*"

Possibly a ruby version issue? But I'm all updated -  Shopify CLI 2.14.0/ruby 2.7.0 as of 03/17/22

Building with Shopify since 2015

agentfitz
Shopify Partner
6 0 0

Hi James. Were you able to find a solution for this? I find it bewildering that Shopify doesn't have an official best practice document on this.

We are trying to do the reverse.. I want to PULL DOWN all sections/*.json (data changes) from the our production theme, but not overwrite all our local code.

While sections are cool in theory, this unholy blending of code and data is likely to cause problems for many users.

James_Wolff
Shopify Partner
2 0 3

Yes this issue was solved in a future release of the Shopify CLI which we discovered many months later. I can't point to a specific release since we never received any official response, updates, or even acknowledgment of the bugs existence from the Shopify team despite reaching out through chat support, emails, and the forums

 

As for your question about pulling down. You are most likely looking for the --only flag which can be found in the Shopify CLI pull documentation:

https://shopify.dev/docs/themes/tools/cli/commands#pull

In your case you're looking to only pull the .json files you store in the section directory which would look like this:

 

 

shopify theme pull --only sections/*.json