|
| 1 | +--- |
| 2 | +title: Experimental Chrome DevTools workspace |
| 3 | +sidebar: |
| 4 | + label: Chrome DevTools workspace |
| 5 | +i18nReady: true |
| 6 | +--- |
| 7 | + |
| 8 | +import Since from '~/components/Since.astro'; |
| 9 | +import { Steps } from '@astrojs/starlight/components'; |
| 10 | + |
| 11 | + |
| 12 | +<p> |
| 13 | + |
| 14 | +**Type:** `boolean`<br /> |
| 15 | +**Default:** `false`<br /> |
| 16 | +<Since v="5.13.0" /> |
| 17 | +</p> |
| 18 | + |
| 19 | +Enables experimental [Chrome DevTools workspace integration](https://developer.chrome.com/docs/devtools/workspaces) for the Astro dev server. |
| 20 | + |
| 21 | +This feature allows you to edit files directly in Chrome DevTools and have those changes reflected in your local file system via a connected workspace folder. This is useful for applying edits such as adjusting CSS values without leaving your browser tab. |
| 22 | + |
| 23 | +With this feature enabled, running `astro dev` will automatically configure a Chrome DevTools workspace for your project. Your project will then appear as an available [workspace source that you can connect](#connecting-your-project). Then, changes that you make in the "Sources" panel are automatically saved to your project source code. |
| 24 | + |
| 25 | +To enable this feature, add the experimental flag `chromeDevtoolsWorkspace` to your Astro config: |
| 26 | + |
| 27 | +```js title="astro.config.mjs" ins={4-6} |
| 28 | +import { defineConfig } from 'astro/config'; |
| 29 | + |
| 30 | +export default defineConfig({ |
| 31 | + experimental: { |
| 32 | + chromeDevtoolsWorkspace: true, |
| 33 | + }, |
| 34 | +}); |
| 35 | +``` |
| 36 | + |
| 37 | +## Connecting your project |
| 38 | + |
| 39 | +Astro will create the necessary configuration file to support Chrome DevTools workspaces. However, your project must also be [connected as a source](https://developer.chrome.com/docs/devtools/workspaces#manual-connection) to enable file saving. |
| 40 | + |
| 41 | +<Steps> |
| 42 | + |
| 43 | +1. [Start the Astro dev server](/en/develop-and-build/#start-the-astro-dev-server) with the appropriate CLI command for your package manager. |
| 44 | + |
| 45 | +2. Navigate to your site preview (e.g. `http://localhost:4321/`) in Chrome and open DevTools. |
| 46 | + |
| 47 | +3. Under the **Sources** > **Workspaces** tab, you will find your Astro project folder. Click **Connect** to add your directory as a workspace. |
| 48 | + |
| 49 | +</Steps> |
| 50 | + |
| 51 | +See the [Chrome DevTools workspace documentation](https://developer.chrome.com/docs/devtools/workspaces#connect) for more information. |
0 commit comments