yireo / magento2-dump-cms-content
N/A
Package info
github.com/yireo/Yireo_DumpCmsContent
Type:magento2-module
pkg:composer/yireo/magento2-dump-cms-content
Requires
- php: >=8.2 <8.6
- ext-pcre: *
- magento/framework: ^103.0
- magento/module-cms: ^104.0
- symfony/console: ^5.0 | ^6.0 | ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.5 || ^10.5
- yireo/magento2-integration-test-helper: ~0.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-28 22:21:47 UTC
README
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.