Ad

How To Test Shopify Themes Locally?

- 1 answer

I was wondering what the best way was to deploy shopify themes locally for testing before deploying. We recently started employing deploybot. We really like deploybot but we also would like a way to not wait five minutes to test our files in an alternate store.

How would I accomplish this?

Ad

Answer

For anyone coming to this in 2018, we now have use of Slate.

https://shopify.github.io/slate/

For an idea of workflow, we have multiple devs working on the same theme and they can see their changes locally with Slate.

How we achieve this

  • We have a dev store that is a direct clone of our production store.
  • Each dev creates another theme on the dev store and branches off master locally. They then will ONLY use the theme id of the theme they just created to work with (updated in their config.yml)
  • Slate will watch changes and deploy to their preview theme and refresh their browser locally too.
  • Once the dev is happy with their changes, we merge back into master and deploy to the live (master) theme on our dev store.
  • Once it passes all the tests on our dev store, we push to a production store using slate.

EDIT - For creating new section files, template files, product templates etc

You won't be able to create these files and for them to be displayed locally without a small workaround.

For example, if you create a new product template ("product.my-product.liquid"), you'll need to Publish your preview theme first, then perform a "slate start" in terminal, select your new product template for whatever product you're using it on in Shopify, then re-publish your "master" theme.

You may need to do another "slate start" to get the new theme template displaying on the product locally, but it will work.

This is because Shopify only allows you to assign product templates to the current active theme.

Ad
source: stackoverflow.com
Ad