-
Notifications
You must be signed in to change notification settings - Fork 0
Live Preview Overview
State of Live Preview (formerly known as "Live Development") as of January, 2015.
Live Preview has been implemented 2 ways:
-
Chromium Dev Tools web socket (original)
-
New Multibrowser Implementation using Injected scripts
- Currently disabled and can be switch to with a feature flag
- Connects to default browser
- URL can be pasted into any other browser
- See Live Preview MultiBrowser for details about this implementation.
Implementation is set in LiveDevelopment/main.js `_setImplementation()' method.
3 types of server connections:
- Built-in nodejs server - this is the default connection type.
- Use local server - this is done by specifying Base URL in Project Settings... dialog.
- Fallback is
file://
protocol.
For more info see Server API and URL Mapping docs.
Loaded to ensure a connection before starting agents and then navigating to document url.
-
NativeApp.openLiveBrowser()
andNativeApp.closeLiveBrowser()
defined in appshell/appshell_extensions.js calls operating system specific nativeOpenLiveBrowser()
andCloseLiveBrowser()
methods, respectively. Defined in:
Used to toggle Live Preview on/off. Can also use File > Live Preview menu item.
Icon shows 3 different states: disconnected, connecting, and connected. Tooltips display more detailed state information. Twipsy is displayed at icon when browser is disconnected for external reasons.
Agents/RemoteAgent.js injects Agents/RemoteFunctions.js into Live Preview page for:
- Highlighting
- Live HTML
- Editing CSS
- LiveDevelopment.js _styleSheetAdded
- creates a CSSDocument for each stylesheet
- updating CSSDocument.onChange sends updated stylesheet to browser
- Highlighting all elements that apply to current rule
- can enable/disable with pref, menu command
- remote function injection & calling
Currently only supported with nodejs server
-
Editing HTML
-
Highlighting current element
-
Kevin's talk at JSConfEU - first ~17 minutes
Reload File on Save
Live JavaScript Research - not yet implemented.
Other Use Cases:
-
When starting Live Preview...
- if .css or .js file is selected, Brackets searches for nearest index.html
- if .php is selected and Base URL is not specified, prompt for Base URL
-
If Live Preview is running...
- and another HTML file is selected, it switches to that file
- and switch to a different project, Live Preview is disconnected
- Live Development: lifecycle research and future directions
-
experimental
flag: very old, so most likely no longer works