Hydrogen Theme

March 4, 2025 ยท View on GitHub

Build status License: MIT

A port of Hydrogen's default template to Shopify OS 2.0.

pika-1697163139924-1x

๐Ÿ”จ Requirements

๐Ÿš€ Project Structure

This theme leverages the default Shopify theme folder structure and introduces the following directories, some of which have special behaviors.

โ””โ”€โ”€ hydrogen-theme
    โ””โ”€โ”€ frontend
        โ”œโ”€โ”€ entrypoints
        โ”œโ”€โ”€ islands
        โ”œโ”€โ”€ lib
        โ””โ”€โ”€ styles
SubdirectoryDescription
entrypointsThe entry points for your theme
islandsThe interactive islands in your theme
libTheme specific libraries
stylesThe styles of your theme

๐Ÿงž Commands

CommandAction
pnpm installInstalls dependencies
pnpm dev -- --store johns-apparelLaunch the Shopify and Vite servers in parallel
pnpm run deployBundle your theme's assets and upload your local theme files to Shopify

๐Ÿ๏ธ Hydration Directives

The following hydration strategies are available (borrowed from Astro).

DirectiveDescription
client:idleHydrate the component as soon as the main thread is free
client:visibleHydrates the component as soon as the element enters the viewport
client:mediaHydrates the component as soon as the browser matches the given media query

Usage:

<my-component client:visible>This is an island.</my-component>

๐Ÿ™‡โ€โ™‚๏ธ Thanks

We would like to specifically thank the following projects for the inspiration and help regarding the creation of hydrogen-theme: