yireo / magento2-dump-cms-content
N/A
Yireo DumpCmsContent
A Magento 2 module that adds a CLI bin/magento cms:dump to dump all CMS pages and CMS blocks to a folder var/cms-output.
Why?
This module was developed with Hyva Themes in mind: With a theme based on Hyva, your Tailwind CSS will need to be purged before going into production. For this, you would configure the Tailwind configuration to look into certain content folders to make sure CSS utility classes that are actually used, are not purged from the production CSS. Unfortunately, this does not work with the database.
Once you add Tailwind CSS classes to your CMS Blocks and CMS Pages (via the Magento Admin Panel, for instance by using some Tailwind-oriented WYSIWYG editor, or by inserting code manually), these CSS classes might or might not be purged, which could lead to incorrect CSS styling. To prevent this from happening, this module allows you to dump CMS contents to a folder var/cms-output, which could then be included in the Tailwind configuration:
module.exports = {
...
purge: {
content: [
...
'../../../../../../../var/cms-output/**/*.html'
]
}
}
Usage
bin/magento cms:dump
bin/magento cms:dump --include-inactive
By default, only active CMS blocks and CMS pages are dumped. Use --include-inactive to also dump disabled content.
Every file is named cms-block-{id}-{identifier}.html or cms-page-{id}-{identifier}.html. All characters of the identifier except a-z, 0-9, _ and - are replaced with _, so all files end up directly in var/cms-output. Entries without content are skipped.
Security notes
- The folder
var/cms-outputis emptied on every run. Do not store anything else in it. - The command refuses to write when
var/cms-outputis a symlink pointing elsewhere. - The dump contains raw CMS content. Do not commit
var/cms-outputto a repository and make sure it is not publicly accessible via the webserver.
Current status
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.1.0] - 25 November 2026
Added
- New
--include-inactiveoption forcms:dumpto also dump disabled CMS pages and blocks cms:dumpnow reports how many files were written- README documents the
cms:dumpoptions and security notes - PHP 8.5 support
Changed
cms:dumpnow only dumps active CMS pages and blocks by default- Dump file names now combine the entity ID with a sanitized identifier (e.g.
cms-page-12-about-us.html) - CMS content is loaded in batches of 100 to keep memory usage low on large stores
Removed
- PHP 8.1 support (now PHP 8.2 - 8.5)
Fixed
- CMS identifiers containing path segments (like
../) could write files outsidevar/cms-output(path traversal) - The dump is refused when
var/cms-outputis a symlink - Stale files from previous dumps are removed and CMS items without content are skipped
- Missing composer dependencies (
magento/module-cms,ext-pcre,symfony/console) are added andmagento/frameworkis restricted to^103.0
[1.0.0] - 09 October 2025
Fixed
- Copy generic CI/CD files
- Fix PHP 8.4 issue in Symfony Command
- Add success return code
- New license
- Update composer.json
Requires 5
| Package | Constraint |
|---|---|
| ext-pcre | * |
| magento/framework | ^103.0 |
| magento/module-cms | ^104.0 |
| php | >=8.2 <8.6 |
| symfony/console | ^5.0 | ^6.0 | ^7.0 |
Requires-dev 2
| Package | Constraint |
|---|---|
| phpunit/phpunit | ^9.5 || ^10.5 |
| yireo/magento2-integration-test-helper | ~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.
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.
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.
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
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.
More from yireo
View vendorReplace bundled third party packages from Magento
N/A
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.