PhpStorm 8.0.2 Web Help

Live Editing of HTML, CSS, and JavaScript

During a JavaScript debugging session, you can monitor how the changes you make in the HTML file are rendered in the actual browser window without refreshing the page manually and even without leaving PhpStorm. All the changes you make are immediately reflected in the browser and the affected area is highlighted. Besides pure HTML files, this also works for other file types that contain or generate HTML, CSS, or JavaScript. You just need to specify the URL of the page in the JavaScript Debug run configuration. The live contents of the page being edited are shown in the Elements tab of the Debug tool window.

Currently the Live Edit functionality is supported only for Google Chrome and only during a debugging session.

On this page:

Prerequisites

  1. The LiveEdit plugin is installed and enabled.

    The plugin is not bundled with PhpStorm, but it is available from the PhpStorm plugin repository. Once enabled, the plugin is available at the IDE level, that is, you can use it in all your PhpStorm projects.

  2. The JetBrains Chrome Extension is installed in your Chrome browser.

    The extension is installed when you first initiate a debugging session and follow the dedicated link provided by PhpStorm. For details, see Using JetBrains Chrome Extension and http://confluence.jetbrains.com/display/WI/How+to+install+Chrome+extension.

Configuring the Live Edit update policy in the debugging mode

  1. Open the Settings dialog box by choosing File | Settings . Expand the Debugger node under Build, Execution, Deployment, and then click Live Edit. The Live Edit page that opens.
  2. In the Update area, configure the way changes made to the code during a debugging session are applied. Note that an update will now be performed only if none of the modified files have any syntax errors.
    • Auto in (ms): Choose this option to have the changes applied automatically at certain time interval and specify the delay in ms in the text box. This policy is not available for the client-side code of Meteor applications.
    • Manual: Choose this option to apply the changes manually by clicking the Update <run configuration name> JavaScript button update_icon or the Update <run configuration name> button update_icon on the toolbar of the Debug tool window.

      It is recommended that you choose this option for debugging Meteor applications because applying changes to the client-side code is not supported.

    • Restart if hotswap fails:

      With changes in HTML, CSS, and JavaScript on the client side, the contents of a Web page in the browser are updated without reloading. For NodeJS or Meteor applications, PhpStorm first tries to update the application incorporating the changes without restarting the NodeJS server.

      • Select this check box to have PhpStorm try restarting the server if the changes cannot be applied automatically. After the restart, PhpStorm brings you to the execution point where the problem took place.

        If even with this option chosen automatic upload still fails, tou will have to restart the server manually by clicking the Rerun <run configuration name> button rerun.

      • When the check box is cleared, PhpStorm just displays a pop-up window informing you about the failure and suggesting you to restart the server manually.

Live editing during a debugging session

  1. When editing the code and monitoring how the changes are rendered in the browser, it is helpful to have the areas affected by the changes highlighted. To enable highlighting affected areas, open the PhpStorm settings dialog box, click Live Edit, and then select the Highlight current element in browser check box on the Live Edit page that opens.
  2. To initiate a debugging session, create a run configuration of the type JavaScript Debug and click the Debug button debug on the toolbar. PhpStorm establishes connection with the JetBrains Chrome extension and starts a debugging session.
  3. Edit the HTML file that implements the page opened in the browser and view the changes immediately rendered.

See Also

Last modified: 10 December 2014