or run

tessl search
Log in

Version

Files

tile.json

task.mdevals/scenario-5/

MJML Email Builder CLI

Build a command-line tool that processes email templates and generates responsive HTML output with validation and error handling.

Capabilities

Process email template files

Build a CLI tool that accepts template file paths and converts them to HTML format.

  • Processing "email.mjml" generates "email.html" with valid HTML content @test
  • Processing "email1.mjml email2.mjml" generates both "email1.html" and "email2.html" @test
  • Processing "email.mjml --output dist/" saves "dist/email.html" @test

Validate template syntax

Add validation mode to check templates without generating output.

  • Running "builder --validate valid.mjml" exits with code 0 and no output @test
  • Running "builder --validate invalid.mjml" exits with code 1 and displays error messages @test

Format output HTML

Support different output formatting options for generated HTML.

  • Running "builder template.mjml --beautify" generates HTML with proper indentation and line breaks @test
  • Running "builder template.mjml --minify" generates HTML with whitespace removed @test

Watch for file changes

Implement watch mode to automatically recompile templates when they change.

  • Running "builder template.mjml --watch" recompiles when template.mjml is modified @test
  • Running "builder templates/*.mjml --watch" recompiles any matching file when modified @test

API

/**
 * Main CLI entry point
 * Processes MJML template files based on command-line arguments
 *
 * @param {string[]} args - Command-line arguments
 * @returns {Promise<void>}
 */
async function main(args);

/**
 * Processes a single template file
 *
 * @param {string} inputPath - Path to MJML template file
 * @param {object} options - Processing options
 * @param {string} [options.output] - Output file or directory path
 * @param {boolean} [options.beautify] - Beautify HTML output
 * @param {boolean} [options.minify] - Minify HTML output
 * @returns {Promise<{success: boolean, errors: Array}>}
 */
async function processTemplate(inputPath, options);

/**
 * Validates a template file without generating output
 *
 * @param {string} inputPath - Path to MJML template file
 * @returns {Promise<{valid: boolean, errors: Array}>}
 */
async function validateTemplate(inputPath);

/**
 * Watches template files for changes and recompiles
 *
 * @param {string[]} filePaths - Paths to template files to watch
 * @param {object} options - Processing options
 * @returns {Promise<void>}
 */
async function watchTemplates(filePaths, options);

Implementation

@generates

Dependencies { .dependencies }

mjml { .dependency }

Provides MJML to HTML conversion functionality with validation and formatting options.

@satisfied-by