Sources Workspace Mapping, Automatic Connection, and Local File Persistence
How DevTools Workspaces map localhost files to local folders, auto-connect via devtools.json, save CSS/HTML/JS, and differ from Local overrides.
This page summarizes Chrome DevTools documentation on Workspaces: mapping network resources from a local dev server to folders on your machine so edits in the Sources panel persist to real project files. Most of the material comes from Google’s workspace and automatic-connection guides; related panels (Changes, Local overrides, AI assistance) are included only where they affect saving work back to disk.
Workspace is a powerful feature that lets you directly edit your website’s source files from within Chrome DevTools, eliminating the need to constantly switch between your code editor and the browser.
Workspace: what it does and when you need it
Section titled “Workspace: what it does and when you need it”A Workspace maps files served by your web server to files in a local folder. With a folder connected, changes you make in DevTools’ Sources panel can be written to the same files your editor uses.
A Workspace in Chrome DevTools maps files served by a web server to files in a local folder on your computer. When you enable a workspace for a local project, any changes you make to the files in the DevTools’ Sources panel are automatically saved to your local project files.
People usually set up a workspace when they want to tweak CSS or JavaScript in the browser and keep those edits in version-controlled sources—not only in the running page. By default, edits in Sources are lost on reload unless you connect a workspace or use another persistence feature (see Local overrides vs Workspaces).
By default, when you edit a file in the Sources panel, those changes are lost when you reload the page. Workspaces enable you to save the changes that you make in DevTools to your file system. Essentially, this lets you use DevTools as your code editor.
— Google, Sources panel overview
Automatic workspace connection: devtools.json and localhost
Section titled “Automatic workspace connection: devtools.json and localhost”How Chrome DevTools discovers a workspace on localhost
Section titled “How Chrome DevTools discovers a workspace on localhost”Automatic workspace connection removes manual “add folder” steps when your dev server exposes metadata at a fixed path. While you debug a site served from localhost, DevTools requests:
/.well-known/appspecific/com.chrome.devtools.json
If the response is valid JSON, DevTools can offer a Connect control under Sources → Workspaces.
Automatic workspace connection works by having your local development server expose a specific JSON file at a predefined path. When Chrome DevTools is open and you are navigating a website served from localhost, it automatically sends a request to:
/.well-known/appspecific/com.chrome.devtools.json
The payload typically looks like this:
{ "workspace": { "root": "/Users/yourname/path/to/your/project", "uuid": "a-random-version-4-uuid" }}| Field | Role |
|---|---|
workspace.root |
Absolute path to the project root on your file system (OS-specific). |
workspace.uuid |
UUID v4 so DevTools can tell projects apart. |
Once DevTools receives and processes this file, it offers a Connect button in the Sources > Workspaces panel.
Local development only—not for production
Section titled “Local development only—not for production”Discovery via this URL is meant for local development only.
The automatic workspace discovery mechanism through devtools.json is designed exclusively for local development environments and only works when your application is served from localhost. … This feature is not intended for production environments.
Serve the JSON with Content-Type: application/json on GET for that path. Because workspace.root is machine-specific, keep generated metadata out of git (for example via .gitignore).
Google documents two placement options:
- Serve dynamically at
/.well-known/appspecific/com.chrome.devtools.jsonfrom your dev server (automatic connection). - Place the file at
path/to/project/root/.well-known/appspecific/com.chrome.devtools.jsonand ensure your HTTP server serves it (Set up workspaces).
Example: Node.js and Express endpoint
Section titled “Example: Node.js and Express endpoint”In non-production builds, register a route that returns root and a fresh UUID:
if (process.env.NODE_ENV !== 'production') { app.get('/.well-known/appspecific/com.chrome.devtools.json', (req, res) => { const projectRoot = path.resolve(__dirname); const workspaceUuid = uuidv4();
res.json({ workspace: { root: projectRoot, uuid: workspaceUuid, }, }); });}— pattern from Google, Automatic Workspace connection in Chrome DevTools
If you do not use automatic discovery, harmless 404 logs for that path are normal; you can ignore them or return 404 without logging (same guide).
Manual workspace connection: add folder and grant access
Section titled “Manual workspace connection: add folder and grant access”Connect from Sources → Workspaces
Section titled “Connect from Sources → Workspaces”-
Open your locally hosted page in Chrome and open DevTools.
-
In Sources → Workspace, click Connect (after auto-discovery) or Add folder manually and pick your source tree (Set up workspaces).
-
When prompted, choose Edit files / Allow so DevTools may write to that folder (Connect a workspace folder).
-
Confirm mapping: a green dot on HTML, CSS, and JavaScript files under Workspaces means DevTools linked network resources to disk files (Connect a workspace folder).
You can also drag a folder into the Sources panel or manage folders under Settings → Workspace. Changing or deleting the UUID in the metadata JSON disconnects the folder (Remove a workspace folder connection).
To remove a connection: Sources → Workspaces → right-click the folder → Remove from Workspace (Automatic Workspace connection).
To turn off automatic discovery in the browser: chrome://flags → disable DevTools Project Settings and/or DevTools Automatic Workspace Folders, then relaunch Chrome (Automatic Workspace connection).
Save CSS, HTML, and JavaScript from DevTools to disk
Section titled “Save CSS, HTML, and JavaScript from DevTools to disk”CSS: live preview, then save to source
Section titled “CSS: live preview, then save to source”Open a mapped CSS file from Sources → Workspaces, edit, then save (Ctrl+S / Cmd+S). The change applies on the page immediately; saving writes the file. You do not need a full page reload for CSS (Save changes to CSS).
HTML and JavaScript: save, then reload or redeploy
Section titled “HTML and JavaScript: save, then reload or redeploy”For HTML and JS, edits do not hit the live page or disk until you save; reload the page (or let your dev server hot-reload) to see HTML/JS effects (Save changes to HTML, Save changes to JavaScript).
For JavaScript, DevTools patches the engine on save; only changes inside functions take effect without re-running the whole script—a constraint of the Editor workflow described in Sources panel overview.
Why Elements panel DOM edits do not sync to HTML files
Section titled “Why Elements panel DOM edits do not sync to HTML files”Workspace saves apply to files you open in Sources, not to arbitrary DOM tree edits in Elements.
The tree of nodes that you see on the Elements panel represents the page’s DOM. … This makes it difficult for DevTools to resolve where a change made in the Elements panel should be saved, because the DOM is affected by HTML, JavaScript, and CSS. In short, the DOM Tree !== HTML.
— Google, Set up workspaces
For Styles-pane CSS tied to an HTML file, persistence may also fail; edit the HTML file in Sources instead (Local overrides limitations).
Source maps and optimized bundles
Section titled “Source maps and optimized bundles”Modern frameworks ship transformed code. Workspaces usually map optimized bundles back to authored files when source maps are available.
An automatic (or manual) connection to a workspace folder lets you save a change that you make in DevTools to a local copy of the same file on your computer. … Moreover, DevTools is usually able to map the optimized code back to your original source code with the help of source maps.
— Google, Set up workspaces
Enable JavaScript source maps (and CSS maps if needed) under Settings → Preferences → Sources (Debug with source maps). Use Developer Resources (More tools) to verify map load status or load maps manually (Developer Resources). Group Authored / Deployed in the Page tree to work on original sources (JavaScript debugging reference).
Changes panel: track in-session edits before they hit disk
Section titled “Changes panel: track in-session edits before they hit disk”The Changes panel lists edits made inside DevTools during the session. It is not a substitute for Workspaces or Local overrides for persistence.
The Changes panel shows only the changes you make within DevTools. If you reload either DevTools or your page, the changes disappear. To make DevTools persist changes across page loads, follow the steps in Local overrides. To make DevTools write changes to your local sources, follow the steps in Edit and save files with Workspaces.
— Google, Changes: Track your HTML, CSS, and JavaScript changes
You can inspect diffs, copy CSS changes in bulk, or revert a file from the Changes UI (View and understand your changes). When AI generates commit messages from Changes, it uses file names and content from your mapped workspace folder (Data usage and enterprise controls).
Local overrides vs Workspaces: persist changes without source files
Section titled “Local overrides vs Workspaces: persist changes without source files”| Workspace | Local overrides | |
|---|---|---|
| Purpose | Save edits to your real project files | Serve modified copies from a folder you choose on reload |
| Survives reload | Yes, on disk in the repo | Yes, in the overrides folder |
| Maps to source tree | Yes (with source maps) | No—experiments and mocks |
| DOM edits in Elements | Not saved to HTML | Not saved to DOM tree |
When you make changes in DevTools, DevTools saves a copy of the modified file to a folder you specify. When you reload the page, DevTools serves the local, modified file, rather than the network resource.
— Google, Override web content and HTTP response headers locally
Local overrides is another DevTools somewhat similar feature that lets you mock web content or request headers. … With local overrides, the changes persist across page loads but don’t map to your page’s source code.
— Google, Set up workspaces
Overrides can mock XHR/fetch bodies and response headers without backend changes (Override XHR or fetch). You cannot override source-mapped files from the Network panel’s Override content action; DevTools steers you to authored sources instead (Override web content).
Workspace settings: exclusions and folder management
Section titled “Workspace settings: exclusions and folder management”Settings → Workspace lists connected folders, excluded subfolders, and a global Folder exclude pattern (default regex skips common third-party paths). Edits under excluded subfolders do not persist (Customize exclusions).
DevTools automatically maps your local sources to network resources using source maps. This way, you can make changes to sources in DevTools and immediately see the effect on the website you host locally and view in Chrome.
— Google, Workspace settings
Common mistakes
Section titled “Common mistakes”- Serving
devtools.jsonin production — automatic discovery is for localhost debugging only (Automatic Workspace connection). - Relative
workspace.root— documentation requires an absolute filesystem path (Create and serve a devtools.json file). - Expecting Elements DOM tweaks to save as HTML — use Sources and a connected workspace (Why can’t you change HTML from the Elements panel?).
- Relying on Changes after reload — use Workspaces or Local overrides for persistence (Changes overview).
- Editing without source maps — saves may target bundled output; enable maps and check Developer Resources.
How to check this on your site
Section titled “How to check this on your site”-
Run your app on
localhost, open DevTools → Sources → Workspaces, and confirm Connect appears or add a folder manually per Set up workspaces. -
In the Network panel, verify a
GETto/.well-known/appspecific/com.chrome.devtools.jsonreturns JSON withworkspace.rootandworkspace.uuidwhen using automatic setup (Automatic Workspace connection). -
Edit a mapped CSS file, save with
Ctrl+S/Cmd+S, and confirm the green-dot indicator and the file on disk match Save changes to CSS. -
Open Changes after an edit; confirm whether you still need Workspace save or Local overrides for reload survival (Changes).
-
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are questioning so it can be corrected.