Upgrade your existing Shopify theme with Slate migrate

If you haven’t read about Shopify’s new theme development toolkit, Slate, check out the introductory post here. It provides you a starting set of files for developing your own custom Shopify theme along with handy build tools to speed up and optimize your workflow.

But what if you’re not starting from scratch? Whether you’re basing your work off an existing theme or supporting a client’s existing theme, there’s no doubt you’ve wanted to improve your development workflow at some point.

With Slate installed (npm install -g @shopify/slate), you can run slate migrate to convert an existing theme into the folder structure compatible with Slate.

Convert your theme with these steps:

  1. Navigate to your theme folder in your terminal of choice
    cd path/to/your/theme
  2. Run the migration command
    slate migrate
  3. Follow the prompts to confirm the action. All valid Shopify theme folders from your root will be moved to the src/ directory
  4. Create a private app and config.yml with your store credentials to link your local environment with your shop. See Slate’s getting started page for these steps.
  5. Run Slate build or sync commands and build away

Running slate build after the migration will generate a dist/ folder in your original root directory. These are the files that will be uploaded to your Shopify store and is a good way to test that the migration process went smoothly.

No you can use any of the Slate commands with your existing theme!

Some caveats:

  • If your root theme folder has a src/ directory for some reason the migration will fail. Rename that folder before trying again.
  • If you already have a package.json file you’re working with an existing build system and you probably know better than this article

Leave a Reply