or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-10/

Multi-Font Email Newsletter Template

Build an email newsletter template system that supports custom font configurations. The system should allow users to define multiple custom fonts and generate responsive HTML emails that properly load only the fonts actually used in the template.

Requirements

Font Configuration

Create a module that accepts a list of custom font definitions and generates an email template with proper font loading. Each font definition includes:

  • Font name
  • Font URL (Google Fonts or custom font URL)

Email Generation

The system should:

  • Generate responsive HTML email output
  • Include only fonts that are actually used in the email content
  • Support multiple text sections with different font assignments
  • Properly handle web-safe fallback fonts

Test Cases

  • Given an email with custom font "Poppins" used in heading and "Roboto" used in body text, the output includes both font imports. @test
  • Given an email with custom font "Open Sans" defined but not used in any content, the output does not include that font's import. @test
  • Given an email using only web-safe fonts (Arial, Times New Roman), the output does not include any custom font imports. @test

Implementation

@generates

API

/**
 * Generates an HTML email with custom font support
 *
 * @param {Object} config - Email configuration
 * @param {Array<{name: string, url: string}>} config.fonts - Custom font definitions
 * @param {Array<{text: string, fontFamily: string}>} config.sections - Text sections with font assignments
 * @returns {string} HTML email output
 */
function generateNewsletterEmail(config) {
  // Implementation
}

module.exports = { generateNewsletterEmail };

Dependencies { .dependencies }

mjml { .dependency }

Provides email template generation and responsive HTML output with font management capabilities.