Code Monkey home page Code Monkey logo

dawn-tailwind's Introduction

Shopify Theme Tailwind

This repository contains a starting point for Shopify Online Store 2.0 Theme development using Tailwind CSS and Vite.

Workflow

  • Create a feature branch
  • Edit theme locally
  • Commit changes to the feature branch
  • Merge feature branch with main branch once feature is implemented. A production build will be created and pushed to the dist branch using Github Actions.

Getting started

Prerequisites

Installation

  1. Clone the repo and install theme: Run the following commands:

    git clone [email protected]:wesselvanree/shopify-theme-tailwind.git
    cd shopify-theme-tailwind
    npm install
    npm run install-theme
    rm -rf .git && git init

    If your default branch is not called main, please replace main with your default branch name in .github/workflows/deploy.yml.

  2. Add script and link tags: Include index.min.css and index.bundle.js in the head tag (after base.css) shopify/layout/theme.liquid

    {{ 'index.min.css' | asset_url | stylesheet_tag }}
    <script src='{{ 'index.bundle.js' | asset_url }}' defer='defer'></script>

    You also need to include other script tags and styles you have added to the entries directory yourself. Vite extracts CSS for each entry to a [name].min.css file in the assets directory, when a stylesheet is shared between multiple entries it becomes a separate css file in the assets directory.

  3. Setup Shopify Github integration: Once you've pushed your first commit to github, a dist branch will be created. Use the Shopify Github integration to sync your theme with the dist branch by going to your admin dashboard > Online Store > Themes > Add Theme > Connect from Github.

  4. Customize tailwind config: By default, tailwind.config.cjs includes custom options for the Dawn theme:

    • Prefix has been set to tw-
    • rem units of the default config are converted to a root font-size of 10px
    • Use CSS variables set in theme.liquid (Dawn) in tailwind config
    • Custom screen breakpoints
    • Preflight has been disabled

Usage

Development

You will need 2 terminal windows:

  1. Start watching for local changes

    npm run dev
  2. Serve your Shopify theme

    shopify login --store your-store-name.myshopify.com
    npm run shopify

If you prefer to use one single terminal window, you can customize the scripts in package.json to use the npm-run-all package.

Production

This repository contains a Github Action that uses JamesIves/[email protected]. This action does not activate Github Pages in your repository but just commits the build to another branch. Currently, the action is configured to deploy the build to the dist branch. You can easily customize this by editing .github/workflows/deploy.yml.

โš ๏ธ Changes made from the Shopify theme editor after deployment will be committed to the dist branch by the Shopify Github integration. You need to manually copy these changes before updating the main branch otherwise these changes will be lost.

Final notes

You might find it useful to copy the Lighthouse Github Action from the original Dawn theme repository to track the performance of your theme on every push.

Further reading

Suggestions

If you have any suggestions to improve this repository, please open an issue. I would be happy to hear from you.

dawn-tailwind's People

Contributors

wandinbaptistchurch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.