Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Shopify/horizon/llms.txt
Use this file to discover all available pages before exploring further.
Core Principles
Horizon is built on four foundational principles that should guide all development work:Web-Native Development
Leverage modern web standards while maintaining backwards compatibility Horizon runs on the evergreen web, utilizing the latest browser features while supporting older browsers through progressive enhancement.Lean and Fast
Functionality defaults to “no” until it meets performance requirements- Ship code based on quality, not quantity
- Build with purpose - don’t support every feature
- Optimize for Core Web Vitals (LCP, FID, CLS)
- Keep JavaScript bundles minimal
Server-Rendered
HTML must be rendered by Shopify servers using Liquid Business logic and platform primitives belong on the server:Functional Design
Functional across browsers, not pixel-perfect- Use semantic markup
- Embrace progressive enhancement
- Design for flexibility, not rigid pixel perfection
- Test across multiple browsers and devices
Development Practices
File Organization
Sections
Sections
Store reusable, configurable content blocks in
/sections/:- Use schema to define customization options
- Keep sections focused on a single purpose
- Use theme blocks for modular content
- Follow naming convention:
main-*.liquidfor template sections
Snippets
Snippets
Store reusable Liquid code in
/snippets/:- Keep snippets small and focused
- Use descriptive names that indicate purpose
- Document required parameters in comments
- Prefix utility snippets with
util-
Assets
Assets
Organize assets by type:
*.css- Stylesheets (prefer modern CSS over preprocessors)*.js- JavaScript modules- Images - Optimized and properly sized
- Fonts - Use Shopify’s font library when possible
Configuration
Configuration
/config/ contains:settings_schema.json- Theme settings definitionsettings_data.json- Theme settings values (don’t commit in Git)
Liquid Best Practices
JavaScript Best Practices
CSS Best Practices
Performance Optimization
Image Optimization
JavaScript Performance
- Defer non-critical JavaScript: Use
deferattribute on script tags - Code splitting: Load features only when needed
- Minimize DOM manipulation: Batch updates and use DocumentFragment
- Debounce expensive operations: Use debounce for scroll/resize handlers
CSS Performance
- Critical CSS inline: Inline above-the-fold CSS
- Avoid @import: Use link tags or bundle CSS
- Minimize specificity: Keep selectors simple
- Use CSS containment: Apply
containproperty where appropriate
Accessibility
Semantic HTML
Semantic HTML
Use proper HTML elements:
ARIA attributes
ARIA attributes
Enhance accessibility with ARIA:
Keyboard navigation
Keyboard navigation
Color contrast
Color contrast
Maintain WCAG AA compliance:
- Text: minimum 4.5:1 contrast ratio
- Large text: minimum 3:1 contrast ratio
- Interactive elements: 3:1 contrast ratio
- Use tools to verify contrast ratios
Testing
Theme Check
Run Theme Check before committing changes:Browser Testing
Test across multiple browsers:- Chrome/Edge (Chromium)
- Firefox
- Safari (macOS and iOS)
- Mobile browsers
Accessibility Testing
- Keyboard navigation: Tab through the entire page
- Screen readers: Test with VoiceOver (macOS) or NVDA (Windows)
- Automated tools: Use Lighthouse, axe DevTools
- Color contrast: Use browser DevTools or online checkers
Performance Testing
- Lighthouse: Run audits in Chrome DevTools
- WebPageTest: Test from different locations and connections
- Core Web Vitals: Monitor LCP, FID, CLS
Version Control
Git Workflow
What to Commit
Do commit:- Theme files (sections, snippets, templates, layouts)
- Assets (CSS, JS, images)
- Configuration schema (
settings_schema.json) - Documentation
settings_data.json(contains store-specific data).DS_Storeor OS-specific files- Node modules or dependencies
- Generated files
Security
Input Sanitization
Content Security
- Use
{{ content_for_header }}for required Shopify scripts - Avoid inline JavaScript when possible
- Validate and sanitize all form inputs
- Use HTTPS for all external resources