M

Shopify Theme Development: Folder Structure and Tailwind Integration with Shopify Admin

Continuing from my previous blog on understanding Shopify folder structures using the home analogy (if you haven't read it yet, I recommend checking it out for better context by clicking here Shopify folder structure), today we'll take the next step by building the required folders from scratch and integrating them with Shopify Admin using Shopify CLI.

Step 1: Creating the Folder Structure

We begin by manually creating the folder structure required for our Shopify theme. For a thorough understanding of the theme architecture , refer to the official Shopify theme architecture documentation. This guide provides a complete breakdown of the essential folders and files. Once we have our folder structure ready with the necessary files, we'll compress the entire folder into a .zip file.

Step 2: Mapping Your Code Editor with Shopify Admin Store Using Shopify CLI

To streamline our development process, we will use Shopify CLI to map our code editor with the Shopify Admin store. First, you'll need to install Shopify CLI by following the official Shopify CLI installation docs . Note: I already have Shopify CLI installed on my system.

For today's work, we will use three essential commands:

1. Shopify theme push - Pushes your local code changes from the editor to the Shopify Admin store.

2. Shopify theme pull - Pulls the latest theme code from Shopify Admin to your local environment.

3. Shopify theme dev - This command allows live checking of changes on your theme. It opens a preview link that reflects your latest updates in real-time, which you can view in the theme editor or via the preview link.

Using shopify theme dev helps you see the changes you make in your code editor instantly, without having to manually upload the theme every time.

Step 3: Uploading the Theme to Shopify Admin

Now that our folder is compressed, we can proceed to upload it to the Shopify Admin where we've previously created our store. (If you need help setting up a Shopify store , you can refer to my earlier blog on store creation for detailed steps.)

I realized that a video explanation would better demonstrate this process. I've attached a complete video tutorial to walk you through integrating folder with shopify admin

After uploading, the next step is to integrate Tailwind CSS. Thanks to the detailed documentation from Tailwind, this process is straightforward as long as we know where to look. We'll follow the Tailwind docs to integrate Tailwind into our theme, which greatly simplifies styling

Step 4: Tailwind Integration

Integrating Tailwind CSS into a Shopify theme might sound challenging, but with the right guidance, it's quite simple. While writing this blog, I realized that a video explanation would better demonstrate this process. I've attached a complete video tutorial to walk you through integrating Tailwind with your custom theme folder.

If you still have any doubts after watching the video, feel free to reach out to me via my social media handles—I'm always happy to help!

Recap in Steps

Here's a quick recap of the steps we've taken so far:

1. Created the folder structure needed for the Shopify theme.

2. Added the required files as per the Shopify theme architecture.

3. Installed Shopify CLI on our system.

4. Compressed the folder into a .zip file.

5. Went to Shopify Admin and navigated to the Online Store.

In a home, you often use small, reusable tools like a screwdriver or a wrench. In Shopify, these reusable pieces of code go into the snippets folder. Here, you might include components like a mini-cart, sidebar, product form, etc., which can be reused across multiple pages.

6. Uploaded the compressed .zip file under the Themes section.

7. Noted down our Shopify store URL by checking the Settings in Shopify Admin.

8. Used the terminal in our code editor and ran Shopify CLI commands, like shopify theme push, shopify theme pull, and shopify theme dev, to map the store with the editor and see live updates.

You will usually see a login option when you run shopify theme dev --store your-store-name, but that wasn't the case for me as I was already logged in. I just needed to press any key, and it showed me as logged in. After that, I got the theme editor link

Finally, integrated Tailwind CSS using the Tailwind docs through Shopify CLI.

Conclusion and Next Steps

We've now set the stage for Shopify theme customization by establishing the folder structure, mapping our code editor with the Shopify store using Shopify CLI, and integrating Tailwind CSS. In my upcoming blogs, we'll dive into practical hands-on tasks like building a navigation bar, footer, pages, blogs, and more. My goal is to make this journey as smooth as possible for you, whether you're working on a personal project or starting a freelance career. Stay tuned for more as we begin practical theme development in the next blog!

© 2024 Mohit Arora