CARVIEW |
Select Language
HTTP/2 200
date: Mon, 14 Jul 2025 14:32:10 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"217ee2037ea860b0340fe72953f1821b"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=wNbdbAbAobHdtlNPOUZTwOWw33zXS2C7NAY5Byq%2BJR%2BN0B3hWn%2FI8kHRVNgJWZrdi0bpQBZJIzSONudIrDUiKc1KSAGVpAom0VsoSbfKnK1qKpV%2FWeI06oULkK3eRaidc9QdBSj4ubJlUzJMrJvv7fDlK%2B%2FDJarHytVNC56HfoncAQ%2FUBiRTiHHJF7r%2FF2DlUKDUfIoU46Kx7i8EM%2B8hO4Kqn15A0mYNyunqbji%2F7QJDeZJ8YfLcCj%2BOLbrlT%2FBjVEuGWDaMEXtuNwuFXKmNng%3D%3D--uFxLe4ocN5p04Ybg--lKdfuDgnf7xcHLkPDDKmxQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1515779339.1752503530; Path=/; Domain=github.com; Expires=Tue, 14 Jul 2026 14:32:10 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 14 Jul 2026 14:32:10 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: D04C:135241:132BCC0:17AC88C:687514EA
Live Preview API · adobe/brackets Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Live Preview API
Jason San Jose edited this page Aug 29, 2013
·
6 revisions
TODO
TODO
Brackets ships with 3 server implementations currently
-
UserServer
- Serves dynamic and static content from the user-specified base URL (File > Project Settings...). Supports live CSS editing but does not support live HTML editing. Typically used for server-side languages like PHP. -
StaticServer
- Serves static content from the built-in HTTP server (via Node.js). Supports both live CSS editing and live HTML editing. Live HTML editing works by serving -
FileServer
- Serves staticfile:
URL sites from the local file system (subject to browser constraints).
/**
* @constructor
* Base class for live preview servers
*
* @param {!{baseUrl: string, root: string, pathResolver: function(string): string}} config
* Configuration parameters for this server:
* baseUrl - Optional base URL (ProjectManager.getProjectRoot().fullPath)
* pathResolver - Function to covert absolute native paths to project relative paths (ProjectManager.makeProjectRelativeIfPossible(absoluteFilePath))
* root - Native path to the project root (and base URL)
*/
function BaseServer(config) {}
/**
* Returns a base url for current project.
*
* @return {string}
* Base url for current project.
*/
BaseServer.prototype.getBaseUrl = function () {};
/**
* Returns a URL for a given path
* @param {string} path Absolute path to covert to a URL
* @return {?string} Converts a path within the project root to a URL.
* Returns null if the path is not a descendant of the project root.
*/
BaseServer.prototype.pathToUrl = function (path) {};
/**
* Convert a URL to a local full file path
* @param {string} url
* @return {?string} The absolute path for given URL or null if the path is
* not a descendant of the project.
*/
BaseServer.prototype.urlToPath = function (url) {};
/**
* Called by LiveDevelopment before to prepare the server before navigating
* to the project's base URL. The provider returns a jQuery promise.
* The Live Development launch process waits until the promise
* is resolved or rejected. If the promise is rejected, an error window
* is shown and Live Development does not start..
*
* @return {jQuery.Promise} Promise that may be asynchronously resolved
* when the server is ready to handle HTTP requests.
*/
BaseServer.prototype.readyToServe = function () {};
/**
* Determines if this server can serve local file. LiveDevServerManager
* calls this method when determining if a server can serve a file.
* @param {string} localPath A local path to file being served.
* @return {boolean} true When the file can be served, otherwise false.
*/
BaseServer.prototype.canServe = function (localPath) {};
/**
* Adds a live document to server
* @param {Object} liveDocument
*/
BaseServer.prototype.add = function (liveDocument) {};
/**
* Removes a live document from the server
* @param {Object} liveDocument
*/
BaseServer.prototype.remove = function (liveDocument) {};
/**
* Clears all live documents currently attached to the server
*/
BaseServer.prototype.clear = function () {};
/**
* Start the server
*/
BaseServer.prototype.start = function () {};
/**
* Stop the server
*/
BaseServer.prototype.stop = function () {};
The snippet below is simplified from the Theseus JavaScript Debugger Extension. It shows a minimal implementation for creating and registering a live preview server.
The interesting part of Theseus isn't shown here. Like our built-in StaticServer
, Theseus' ProxyServer
uses Connect middleware to intercept HTTP requests and serve instrumented content back to the browser.
var LiveDevelopment = brackets.getModule("LiveDevelopment/LiveDevelopment"),
LiveDevServerManager = brackets.getModule("LiveDevelopment/LiveDevServerManager"),
BaseServer = brackets.getModule("LiveDevelopment/Servers/BaseServer");
function ProxyServer(config) {
BaseServer.call(this, config);
}
ProxyServer.prototype = Object.create(BaseServer.prototype);
ProxyServer.prototype.constructor = ProxyServer;
ProxyServer.prototype.canServe = function (localAbsoluteFilePath) {
return myTestIfFileTypeCanBeServedAsAWebPage(localAbsoluteFilePath);
};
ProxyServer.prototype.readyToServe = function () {
var deferred = new $.Deferred();
// ... async initialization of server ...
return deferred.promise();
};
function _createProxyServer() {
var config = {
pathResolver : ProjectManager.makeProjectRelativeIfPossible,
root : ProjectManager.getProjectRoot().fullPath
};
return new ProxyServer(config);
}
// register server provider
LiveDevServerManager.registerProvider({ create: _createProxyServer }, 10);
Clone this wiki locally
You can’t perform that action at this time.