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?
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.
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!