PyCharm 2024.2 Help

Live Edit in HTML, CSS, and JavaScript

With the Live Edit functionality, the changes you make to your HTML, CSS, or JavaScript code are immediately shown in the browser without reloading the page.

Live Editing in HTML and CSS

Live Edit works for other file types that contain or generate HTML, CSS, or JavaScript. You can also use Live Edit when debugging a Node.js application. For more information, refer to Live Edit in Node.js application.

By default, Live Edit is enabled only for HTML and CSS files.

Before you start

  1. Make sure the JavaScript and TypeScript bundled plugin is enabled in the settings. Press Ctrl+Alt+S to open settings and then select Plugins. Click the Installed tab. In the search field, type JavaScript and TypeScript. For more information about plugins, refer to Managing plugins.

  2. Make sure the JavaScript Debugger bundled plugin is enabled in the settings. Press Ctrl+Alt+S to open settings and then select Plugins. Click the Installed tab. In the search field, type JavaScript Debugger. For more information about plugins, refer to Managing plugins.

  3. Install and enable the Live Edit plugin on the Settings | Plugins page, tab Marketplace, as described in Installing plugins from JetBrains Marketplace.

  4. Configure the built-in debugger as described in Configuring JavaScript debugger.

    To have the changes you make to your HTML, CSS, or JavaScript code immediately shown in the browser without reloading the page, activate the Live Edit functionality.

Activate and configure Live Edit in JavaScript

  1. In the Settings dialog (Ctrl+Alt+S) , go to Build, Execution, Deployment | Debugger | Live Edit.

  2. On the Live Edit page that opens, select the Update application in Chrome on changes in checkbox.

  3. By default, PyCharm shows on-the-fly preview only for HTML and CSS code. To enable Live Edit in JavaScript, select the JavaScript, HTML and CSS option.

  4. Specify the time-delay between changing the code in the editor and showing this change in the browser: accept the default value 300 ms or specify a custom value using the spin box next to the corresponding field.

  5. To enable reloading of JavaScript files that are executed by Node.js, select the Update Node.js application on change checkbox. Use the spin box to specify the elapsed time for upload, the default value is 300.

  6. To enable Live Edit in code that can be compiled into JavaScript, HTML, or CSS, for example, in TypeScript, Pug, or SCSS, select the Track changes in files compiled to JavaScript, HTML or CSS checkbox.

    All the changes made in such files are automatically saved to trigger compilation and then appear in the browser.

    Note that a changed file is saved shortly after the update, contrary to regular autosave triggered by closing a file, a project, or PyCharm, or by other events.

  7. To configure highlighting, select the Highlight current element in browser on caret change checkbox. Otherwise, during a debugging session, you will have to hold Shift and hover over the element in the editor to highlight it in the browser.

  8. Select the Restart if hotswap fails checkbox to allow PyCharm to reload the page automatically if the changes couldn't be applied without that.

Use Live Edit

  1. Start a debugging session.

  2. Update your HTML, CSS, or JavaScript code as necessary. The changes are reflected in the browser immediately without reloading the page.

Last modified: 25 June 2024