Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Live Reload routing natively on Magento 2 environment #62

Closed
davidalger opened this issue Jan 6, 2020 · 2 comments
Closed

Support Live Reload routing natively on Magento 2 environment #62

davidalger opened this issue Jan 6, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@davidalger
Copy link
Collaborator

davidalger commented Jan 6, 2020

Magento 2 can be rather simply configured to serve the Live Reload script by including the following bit in the env.php file and running bin/magento app:config:import:

    'system' => [
        'default' => [
            'design' => [
                'footer' => [
                    'absolute_footer' => '<script src="/livereload.js?port=443"></script>'
                ]
            ]
        ]
    ]

Routing requests to this has previously required using per-project configuration in .warden/warden-env.yml to label the php-fpm container as required to serve the Live Reload JS file and process Web Socket requests when grunt watch is running.

In the upcoming Warden 0.2.0 release Live Reload should require nothing more than adding the script tag to the env.php file or including it via design configuration in the admin.

Documentation on how to leverage Live Reload

Please see the corresponding docs page: https://docs.warden.dev/configuration/livereload.html

@davidalger davidalger added the enhancement New feature or request label Jan 6, 2020
@davidalger davidalger added this to the Warden 0.2.0 milestone Jan 6, 2020
@davidalger davidalger self-assigned this Jan 6, 2020
davidalger referenced this issue Jan 6, 2020
…s; added livereload labels natively to php-fpm container and native multi-domain support via wildcards
@zaximus84
Copy link

I encountered a JS issue today that turned out to be the result of the script tag being added for livereload.js. The browser wasn't properly parsing the self-closing tag, so it saw the following script tag's content as being inside of the livereload.js tag.

It was fixed by replacing the self-closing tag with a proper closing tag:
document.write("<script src='/livereload.js?port=443'></script>");

@davidalger
Copy link
Collaborator Author

davidalger commented Feb 25, 2020

@zaximus84 Thanks for the note. That is likely why @erikhansen encountered an issue and suggested a change which is now in the template and docs page on the subject:

It would be good to reference those if encountering issues in the future. I'll update the above description to correct the bad JS bit and reference the docs page as well. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants