The Home for Magento 2 Excellence

Quality-tested Magento 2 modules. Explore. Evaluate. Elevate. #magento2

1090 Modules
617 Ready
473 Need Help
🏆 Leaderboard
Actively Maintained v1.1.0

Development LiveReload

jeanmarcos/module-livereload

Injects the LiveReload browser auto-reload script into Magento 2 storefront and admin pages so code changes refresh the browser automatically during local development. Production injection is disabled by default and gated behind a configurable guard.

0
Downloads
0
GitHub Stars
2mo ago
Last Release
0
Open Issues
Build Issues
0/3 checks passed

Build Tests

Composer Install
DI Compile
Templates

Code Quality

CS Coding Standard
PHPStan

Tested on Magento 2.4.9

Recent Test History

Each release is tested against the latest Magento version at that time.

v1.1.0 on Magento 2.4.9
Jun 7, 2026
v1.0.0 on Magento 2.4.9
Jun 1, 2026

Looking for Contributors

Composer installation fails. Your contribution could help the entire Magento community!

Contribute

Share This Module's Status

Development LiveReload Magento compatibility status badge

README

Loaded from GitHub

📦 jeanmarcos/module-livereload — published to Packagist.

🏠 Source repository for issues, PRs and releases: jeanmarcos-dev/magento-local-development. The standalone jeanmarcos-dev/module-livereload repo is a read-only mirror auto-generated by CI on every release — direct commits to it are overwritten.

Development_LiveReload

⚠️ FOR LOCAL DEVELOPMENT ONLY — Production injection is disabled by default.

Injects the LiveReload browser auto-reload script into Magento 2 storefront and admin pages, so code changes refresh the browser without manual F5.


What it does

Injects the following tag just before </body> on every storefront and admin page:

<script defer src="/livereload.js?port=443"></script>

The script is rendered by Development\LiveReload\Block\Head\LiveReloadScript, which reads the production guard before rendering.

A local LiveReload server (e.g. npx livereload ./pub) must serve /livereload.js for the browser to connect.


Safety model

Mode Allow in Production flag Behavior
developer / default any script injected
production No (default) not injected
production Yes script injected

Implementation: Development_Core (Development\Core\Model\ProductionGuard::isEnabled()), wired via a virtualType in etc/di.xml bound to the config path development/live_reload/allow_in_production, plus Block\Head\LiveReloadScript::_toHtml() — when disabled, returns an empty string so nothing reaches the page.

The block's getCacheKeyInfo() includes the flag, so layout/block cache stays consistent across toggles without needing a full cache flush.


Configuration

Panel path: Stores → Configuration → ⚠ Development Modules → Live Reload → General → Allow in Production

  • Default: No.
  • Changing the flag requires bin/magento cache:clean config layout block_html.

Install

composer require --dev jeanmarcos/module-livereload
bin/magento module:enable Development_LiveReload
bin/magento setup:upgrade
bin/magento cache:flush

Then start a LiveReload server pointing at your theme assets:

# Node-based server example
npx livereload pub/static -p 443

# Or with livereload-bin
livereload ./ --port 443

Kill switch

bin/magento module:disable Development_LiveReload
bin/magento setup:upgrade
bin/magento cache:flush

For permanent removal:

composer remove jeanmarcos/module-livereload

Security and performance considerations

  • Low security impact on its own — serves only static reload JS.
  • If left on in production with no LiveReload server running, every page load returns 404 on /livereload.js, polluting logs and breaking the page speed budget by a negligible margin.
  • The script is loaded with defer, so it does not block rendering.

File structure

LiveReload/
├── Block/
│   └── Head/
│       └── LiveReloadScript.php
├── etc/
│   ├── acl.xml
│   ├── adminhtml/
│   │   └── system.xml
│   ├── config.xml
│   ├── di.xml                       # block wiring + ProductionGuard virtualType
│   └── module.xml                   # depends on Development_Core
├── view/
│   ├── adminhtml/
│   │   └── layout/
│   │       └── default.xml
│   ├── base/
│   │   └── templates/
│   │       └── head/
│   │           └── livereload.phtml
│   └── frontend/
│       └── layout/
│           └── default_head_blocks.xml
├── composer.json
├── registration.php
└── README.md

Troubleshooting

  • Script doesn't appear: check bin/magento deploy:mode:show; if in production, check the flag; then cache:clean layout block_html.
  • Port mismatch: the path /livereload.js?port=443 is hardcoded in view/base/templates/head/livereload.phtml. Edit the template if your server uses a different port.
  • 404 on /livereload.js: LiveReload server is not running — start it or disable this module.

Compatibility

  • Magento 2.4.x
  • PHP 8.1+
  • Depends on jeanmarcos/module-core-local-development (installed automatically by Composer).

License

MIT

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.