Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to develop Shopify themes locally?

Tags:

shopify

I'm going to work on a Shopify theme, and I want to figure out how to run/edit it locally. I'd like to be able to the following, if possible:

  1. Pull all the Shopify theme code from the site to my local computer (ideally a single command line tool)
  2. Make edits locally, and run them locally or in a staging environment
  3. Push all the edits to the main Shopify site, again using a command line tool

Is this at all possible?

like image 700
Sam Lee Avatar asked Aug 06 '16 10:08

Sam Lee


People also ask

Can I install Shopify locally?

The short answer is: no, you can't. It's not possible to install/run Shopify locally to your own server like Wordpress. Shopify is software-as-a-service SaaS which means that Shopify owns the servers and installs/updates/maintains the software that ultimately powers your store.

Which of the following tools do you need to edit Shopify themes locally?

To set up a local environment, you will need the Shopify Theme Kit. The Theme Kit is a cross-platform tool that works on Windows, Linux, and macOS. Theme Kit allows you to use workflow tools like Git, use your preferred text editor, and work on your theme with a team.

Can I upload my own theme to Shopify?

In the Theme library section, click Upload theme. From the Upload theme window, click Choose File to select the ZIP file that you want to upload. Click Upload. The theme will be added to the Themes page of your admin.


1 Answers

There are quite a few workflows you can use here.

1. Task runners

If you're using either Gulp or Grunt locally for development, there are libraries out there that will upload your files to the store through API credentials of a Private App that you have to create. Most work by uploading the files you change, using a watcher.

  1. grunt-shopify
  2. grunt-shopify-upload
  3. gulp-shopify-upload (it's my favourite since I use Gulp but has a known issue that sometimes it stops uploading files and you have to restart it).

2. Official Shopify Theme Kit

Theme Kit is a cross-platform CLI tool that was built by Shopify Employees. It can run on windows/linux/OS X. You can read more about it on Shopify Blog or download it directly. The alternative previously mentioned of Desktop Theme Editor is deprecated and has been replaced by Theme Kit.

3. Third-party SaaS Applications

Instead of watching for changes, these will work with a continuos integration workflow, where your latest push on a certain branch gets uploaded to the theme you've selected.

  1. Beanstalk. More specific information can be found on their landing page for Shopify, here.
  2. DeployBot. Their help article on Shopify has some information on how to get started. Both options are from the same company. Here's a comparison of both they've did on their blog.

4. Third-party libraries

  1. There's also an alternative not officially supported by Shopify which is a TextMate Bundle in case you use that OSX editor.

  2. There's an unofficial extended cli similar to theme kit but with further functionality called Quickshot, which I've just found out based on Matt's response and seems pretty awesome. Some of the features they highlight are:

    • Supports uploading to multiple Shopify stores and themes
    • Easy to use configuration wizard
    • Uploads/downloads in parallel greatly reducing transfer times
    • Supports autocompiling scss locally before uploading to Shopify
    • Supports autocompiling Babel/ES6 into modules which are easily used by - Requirejs and others
    • Can use with .gitignore files or a custom .quickshotignore file.
    • Can download/upload Shopify Blogs, Pages and Products! Easily transfer them between stores! Even the metafields! And edit them locally in your favorite editor.
like image 166
Juan Ferreras Avatar answered Nov 04 '22 03:11

Juan Ferreras