承接 jeanmarcos/module-livereload 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jeanmarcos/module-livereload

最新稳定版本:1.1.0

Composer 安装命令:

composer require jeanmarcos/module-livereload

包简介

Magento 2 development module that injects the LiveReload browser auto-reload script into storefront and admin pages. For local development only — guarded against production mode.

README 文档

README

📦 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

Packagist

⚠️ 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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固