Shopify / themekit

Shopify theme development command line tool.
https://shopify.dev/tools/theme-kit
MIT License
1.19k stars 374 forks source link

edit to json template file and upload via theme watch deletes all content saved in sections for this template #961

Open aloppnow opened 3 years ago

aloppnow commented 3 years ago

I'm editing files locally and using the CLI theme watch command to push changes to Shopify.

I created a json template file with sections in it. Those sections define editable areas (Text, rich text, images). Via theme customizer I add content to those sections and save them, preview works as expected all content is there.

Now locally I make an edit to the json template file (any update, adding new section, rearranging sections in the order array) and theme watch uploads the changes to Shopify, refresh the page -> all content form all sections in this template is gone.

Environment (please complete the following information): -Mac OS

jeffreyguenther commented 3 years ago

I think you'll need to download the file before uploading. You local file is overwriting what's stored in the theme. The JSON template is a theme setting file now, so you need to download it before updating the theme via a watch or deploy.

aloppnow commented 3 years ago

Thanks for answering, so my workflow with theme watch is not helpful?
I built the template file locally, theme watch pushes it to shopify, I add content to it adding additional sections to my local file now triggers the upload. I need to build in a pull the file first ?

Seems a bit disruptive while using theme watch and working on files locally. Also my code editor is set to autosave on program focus change that would also trigger a push to Shopify.

jeffreyguenther commented 3 years ago

Ya, unfortunately so. You should treat the local file as the source of truth. Edits via the customizer don't find their way back to that local file without a download.