magequest / magento2-module-lite-youtube

magequest/magento2-module-lite-youtube

A Magento 2 module that adds Paul Irish's Lite YouTube implementation support.

magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Info Tests: N/A Security: Pass MIT

MageQuest_LiteYouTube

YouTube videos, but performant. For Magento 2.

Magento 2.4 Hyvä Themes Supported Packagist Version MIT License

Overview

A Magento 2 module that adds performant YouTube embeds (with no user experience impact) based on Paul Irish's Lite YouTube implementation.

Includes further enhancements, such as image quality (size), WebP support, custom placeholder images, image lazy loading and a Page Builder content type.

Features

  • Allows use of <lite-youtube> element anywhere on the storefront
  • Can be used in CMS Pages/Blocks, attribute output or even code
  • Adds a Page Builder content type for easier use (with admin preview)
  • Choose default placeholder image quality (size)
  • WebP image format used where browsers support
  • Optionally add custom placeholder image
  • Choose whether placeholder images are lazy loaded
  • Critical CSS added to <head> to negate CLS (Cumulative Layout Shift)
  • Remaining CSS/JS only loaded when <lite-youtube> elements exist on the page

Installation

composer require magequest/magento2-module-lite-youtube
bin/magento module:enable MageQuest_LiteYouTube
bin/magento setup:upgrade

Usage

See Paul Irish's Lite YouTube README for basic usage.

Note: the progressive enhancement option is not recommended with this implementation as both button and imagery can be lazy loaded and by doing so helps reduce CLS (https://web.dev/cls/).

Additional Controls

The following additions are implemented via this fork of Lite YouTube:

  • Default placeholder image quality: quality="hqdefault|sddefault|maxresdefault"
    • hqdefault is default
    • See overview of sizes and availability here
  • Custom placeholder image: image="<image-url>"
  • Disable placeholder image lazy load: lazy="false"

Compatibility

  • Magento Open Source / Commerce Edition 2.4.x
  • Supports Magento 2 Full Page Cache (including Varnish)
  • Supports both Luma/Blank and Hyvä Themes based storefronts
  • Does not support Internet Explorer

FAQs

Can I use the module if a site doesn't have/use Page Builder?

Yes, you can just add <lite-youtube> elements manually to CMS Blocks/Pages, attributes or anywhere else that supports HTML input.

Why does the minified CSS also contain the critical CSS?

Because the CSS is required on both the admin panel and the storefront, I ran into issues with the critical CSS not being recognised in the admin panel and didn't want to maintain 2 separate CSS files for the sake of 10 lines of CSS.

Contributing

Issues and pull requests welcomed.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.

[Unreleased]

[1.0.0] - 2021-11-17

Added

  • Initial Lite YouTube support
  • Page Builder content type
  • Default placeholder image quality (size) selection
  • Default placeholder image WebP support
  • Custom placeholder image option
  • Lazy load placeholder images
Versions
Version Stability QA Status Compatibility Released
1.1.0 stable Pass Magento 2.4.7-2.4.9 Details 2025-05-08 08:30:10
1.0.1 stable Not tested Not yet tested Details 2022-12-22 10:09:03
1.0.0 stable Not tested Not yet tested Details 2021-11-18 07:16:24

Requires 1

Package Constraint
magento/framework >=103.0.0

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Pass 0
PHPMD Pass 0
Cpd Pass 0
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT
Authors
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.