Shopify Theme CLI clearing section data

adaptPatrick
Tourist
6 0 1

Hi, 

We're developing a new bespoke theme for a client & have opted to follow the latest Shopify 2.0 best practices for our development workflow, mainly using the new Shopify Theme CLI tool. 

All works fine in development with the hot reloading etc however when it comes to pushing changes to the theme (using the below command), this results in clearing all of the client's content from the settings_data.json file - despite specifying the "-n" flag to indicate to not remove any remote files not in the local copy. 

shopify theme push -i {theme_id} -u -n

Of course {theme_id} is replaced with the appropriate ID of the theme on our store. 

Could somebody please explain why this is happening and offer any resolutions?

Many thanks,
Patrick 

Replies 5 (5)

Luke_K
Shopify Staff
402 66 98

Hey @adaptPatrick 

Thanks for raising this - it appears you're experiencing this issue. 

We're driving the conversation internally on it - I'll report back to you as soon as I have further information to share.

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Luke_K
Shopify Staff
402 66 98

Hey @adaptPatrick 

I'd caught up with the development team working on this - a workaround they'd mentioned is to run "shopify theme push --ignore "config/*.json"

Let me know if that helps! I don't think that parameter is documented publicly so we'll get that pushed too.

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
adaptPatrick
Tourist
6 0 1

Hi @Luke_K

Thanks for coming back to me here but I don't believe this will resolve the issue, as the content for templates are now stored in the templates/*.json files. So ignoring the config/*.json files wouldn't have any impact - unless I'm mistaken. 

I believe this is still an issue which needs investigating further. 

I have been able to find somewhat of a remedy in the meantime which is to run a `shopify theme pull` before making any changes and subsequently running a `shopify theme push`. However if any changes are made within the Customise feature of Shopify during these commands, they will be lost when running the `shopify theme push`. 

Thanks,
Patrick 

Luke_K
Shopify Staff
402 66 98

Hey @adaptPatrick 

So it seems I jumped the gun with that explicit CLI recommendation above - sorry about that. We're working on pushing functionality to the CLI that's akin to that, it's not been deployed yet. To clarify, it would be a parameter specified in the CLI on push, that would allow you to ignore files in any location.

Great that you've got something resembling a workaround at the moment. Another one (though not ideal) would be to create a .shopifyignore file before running push, and then removing the .shopifyignore file. 

The CLI team actively have this on their radar. Any updates will be posted in the outstanding Github Issue. Thanks!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Luke_K
Shopify Staff
402 66 98

Hey @adaptPatrick 

Just a quick update here that a change had been recently deployed to our CLI, that would allow you to ignore theme files per command.

You may be aware that this had shipped to production already, but I'd been away in the interim - so just thought I'd provide a heads up! Thanks.

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!