Skip to content

ddtcorex/maestro-skills / skills/magento2-hyva-dev

magento2-hyva-dev

Flagged

Use when creating a Hyvä theme or child theme, building an Alpine.js component, making markup CSP-compliant, adding Tailwind classes, or converting Luma to Hyvä. DEPENDENT on magento2-dev-core.

references/tailwind.md

View on GitHub
# Tailwind in a Hyvä theme

The v4 CSS-based config, directory layout, build commands, common classes and responsive
patterns.

### Tailwind v4 (CSS-based config)

Newer Hyvä themes use Tailwind v4, which drops `tailwind.config.js` for a CSS-based config plus a `hyva.config.json` design-token file. Check `web/tailwind/package.json` before assuming either; the two configs are not interchangeable.

```css
/* web/tailwind/tailwind-source.css (shipped default theme 1.4.x/1.5.x structure) */
@import "@hyva-themes/hyva-modules/css";
@import "tailwindcss" source(none);
@source "../../**/*.phtml";
@source "../../**/*.xml";

/* Custom styles */
@import "./base";
@import "./components";
@import "./theme";
@import "./utilities";

/* Generated by the build for Hyvä compatible modules and design tokens */
@import "./generated/hyva-source.css";
@import "./generated/hyva-tokens.css";

@theme {
    --color-primary: oklch(46% 0.2 265);
}
```

```json
// hyva.config.json
{
  "tokens": {
    "src": "hyva.design.tokens.json",
    "format": "default",
    "cssSelector": "@theme"
  }
}
```

Generate tokens/sources with `npx hyva-sources` / `npx hyva-tokens` rather than hand-rolling them. Alpine gating: Tailwind v4 sources come from CSS `@source` directives and `hyva.config.json` `tailwind.include`/`exclude`; editing `hyva.config.json` on a v3 setup is a silent no-op, verify `web/tailwind/package.json` `tailwindcss` major before touching either config.

### Directory Structure
```
web/tailwind/
├── package.json
├── tailwind-source.css      # Main entry (imports the files below)
├── generated/               # Written by npx hyva-sources / hyva-tokens, do not edit
├── components/
│   ├── button.css
│   ├── forms.css
│   └── messages.css
├── utilities/
│   └── custom-utilities.css
└── theme/
    ├── header.css
    └── footer.css
```

### Build Commands
```bash
# Development with watch
npm run watch

# Production build
npm run build

# PurgeCSS config (auto-included)
# Tailwind automatically removes unused classes
```

### Common Classes

```html
<!-- Buttons -->
<button class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700">
    Add to Cart
</button>

<!-- Forms -->
<input type="text"
       class="w-full border border-gray-300 rounded px-3 py-2 focus:border-blue-500 focus:outline-none">

<!-- Cards -->
<div class="bg-white rounded-lg shadow-md p-4">
    <!-- Content -->
</div>

<!-- Grid -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
    <!-- Items -->
</div>
```

### Responsive Design
```html
<!-- Mobile first -->
<div class="w-full md:w-1/2 lg:w-1/3">
    <!-- Shows 100% on mobile, 50% on tablet, 33% on desktop -->
</div>
```
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall