Themekit Deployment Workflow for Dev -> Production
Theme Kit is a cross-platform tool for building Shopify Themes.
https://shopify.github.io/themekit/
SETUP
You want two shopify plus intances setup. Ensure that you create the private ThemeKit App per the instructions on the themekit site.
- PRODUCTION: This is your primary site.
- DEV: This is your developer / staging site. Password protect this.
Note: Yes, you could have DEV and PRODUCTION on the same Shopify Instance and use different Themes to manage the front-end. However if you are testing apps or data, then I recommend two separate environments for sanitation purposes. Don't shit where you eat.
github setup
For our theme and site development, I host the code base at github. This ensures that I can rollback changes efficiently and push those changes out to my shopify instances.
https://guides.github.com/activities/hello-world/
first theme "get"
To connect an existing theme, you need the theme’s ID number. The easiest way to get your theme’s ID number is to use the get command like this:
$ cd my-shopify-theme (master) $ theme get --list -p=[your-password] -s=[you-store.myshopify.com]
Then once you have noted your theme ID, run the following command to generate a config (config.yml) and download the theme from shopify:
$ theme get -p=[your-password] -s=[you-store.myshopify.com] -t=[your-theme-id]
Next you can edit the config.yml and create the two instances using the one you just got above as the production instance.
edit config.yml
production: password: [API PASSWRD FOR ThemeKit Private App] theme_id: "[ThemeId]" store: [your prod site].myshopify.com dev: password: [API PASSWRD FOR ThemeKit Private App] theme_id: "[ThemeId]" store: [your dev site].myshopify.com
SAMPLE DEV WORKFLOW
Now when you edit theme files, you can deploy them to the test server first.
$ theme --env=dev deploy
or if you are working in near real-time using the 'watch' flag, you can use
$ theme --env=dev watch
DEPLOY TO PRODUCTION
When you are ready to deploy to production:
FINAL THOUGHTS
This is a very simple deploy methodology using separate server / theme environments. Ensure you are using git checkins regularly.
If you're interesting in finding some tools that automate this, I've found the following: