email-theme-styling
БесплатноБез исполняемых скриптовНе проверенComprehensive guide for theming and styling Magento 2 transactional emails via theme files, including Hyvä-specific considerations, CSS inlining architecture…
от ProxiBlue★ 17 звёзд на GitHubОб этом скилле
Magento 2 Email Theme & Styling Skill
Purpose
This skill provides comprehensive guidance on theming and styling Magento 2 transactional emails via theme files. It covers the full email rendering pipeline, CSS inlining architecture, template override patterns, Hyvä Email module integration, and the Tailwind-to-LESS compilation approach.
When to Use This Skill
- Customizing the look and feel of transactional emails (order confirmation, account creation, etc.)
- Overriding email header/footer templates via the theme
- Adding custom CSS styles to emails
- Setting up a custom email logo
- Debugging email rendering or CSS inlining issues
- Understanding how Hyvä interacts with the email system
- Using Tailwind CSS as a source for email styles
Architecture Overview
Email Rendering Pipeline
1. Module defines template in email_templates.xml (e.g. sales_email_order_template)
↓
2. TransportBuilder triggers template rendering
↓
3. AbstractTemplate::getProcessedTemplate()
- applyDesignConfig() → emulates store/theme context
- addEmailVariables() → populates store data, template_styles
↓
4. Filter->filter(templateText) processes directives:
- {{template config_path="design/email/header_template"}} → includes header
- {{template config_path="design/email/footer_template"}} → includes footer
- {{css file="css/email.css"}} → outputs CSS in <style> tag
- {{inlinecss file="css/email-inline.css"}} → queues CSS for inlining
- {{var variable}} → outputs variable values
- {{trans "text"}} → translatable strings
- {{layout handle="..."}} → renders layout blocks
↓
5. applyInlineCss() callback:
- Loads compiled CSS via asset repository
- Processes CSS placeholders (@base_url_path, @locale)
- Passes HTML + CSS to Emogrifier (Pelago\Emogrifier\CssInliner)
- Emogrifier converts CSS selectors to inline style="" attributes
↓
6. Final inlined HTML sent via SMTP transport (Symfony Mailer)
Two-File CSS Strategy
Magento splits email CSS into two files because email clients like Gmail strip <style> tags:
| File | Purpose | Directive | Processing |
|---|---|---|---|
email-inline.css (from email-inline.less) |
Styles that CAN be inlined | {{inlinecss file="css/email-inline.css"}} |
Emogrifier converts to style="" attributes |
email.css (from email.less) |
Styles that CANNOT be inlined | {{css file="css/email.css"}} |
Placed in <style> tag (media queries, :hover, @font-face) |
The header template (header.html) contains both directives:
<style type="text/css">
{{var template_styles|raw}}
{{css file="css/email.css"}}
</style>
<!-- ... later in the template ... -->
{{inlinecss file="css/email-inline.css"}}
The template_styles Variable
Each email template can declare per-template styles in a <!--@styles @--> comment block at the top:
<!--@styles
.custom-class { color: #333; }
@-->
These are injected into the <style> tag via {{var template_styles|raw}}.
Hyvä Email Module
Why It Exists
Hyvä replaces the Luma/Blank LESS-based frontend with TailwindCSS. This breaks the LESS file inheritance chain that Magento's email system depends on. The hyva-themes/magento2-email-module re-adds the necessary LESS files and creates a fallback specifically for email rendering.
Module: Hyva_Email (enabled in app/etc/config.php)
Location: vendor/hyva-themes/magento2-email-module/src/
What It Does
- FallbackRulePlugin - Adds the module's
view/frontend/webdirectory to the design fallback soemail.lessandemail-inline.lessare found during static content deployment - PackageFilePlugin - Treats the module's static files as global scope for proper deployment
What It Does NOT Do
- Does NOT provide custom email templates (uses default Magento templates)
- Does NOT change the CSS inlining mechanism (still uses Emogrifier)
- Does NOT use TailwindCSS for emails (uses LESS, same as Luma)
LESS Files Provided
Located at vendor/hyva-themes/magento2-email-module/src/view/frontend/web/css/:
| File | Purpose |
|---|---|
email.less |
Master non-inline styles import file |
email-inline.less |
Master inline styles import file |
email-fonts.less |
@font-face declarations |
source/_email-base.less |
Core email stylesheet (resets, layout, typography, tables, buttons) |
source/_email-extend.less |
Theme customization file (extend without copying _email-base) |
source/_email-variables.less |
Variable overrides for email-specific values |
source/_variables.less |
Local theme variable overrides |
source/_theme.less |
Global theme variable overrides |
source/_typography.less |
@font-face rule generation |
LESS Import Chain (email-inline.less)
@import 'source/lib/_lib.less'; // Global Magento UI library
@import 'source/lib/variables/_email.less';
Установить email-theme-styling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл email-theme-styling?
Comprehensive guide for theming and styling Magento 2 transactional emails via theme files, including Hyvä-specific considerations, CSS inlining architecture, and template override patterns.
Как установить скилл email-theme-styling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл email-theme-styling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic