2018-09-19 15:37:38 -07:00
# :rotating_light: Deprecated
Please use the new Webview API instead:
2018-12-16 21:08:20 -08:00
- Guide: https://code.visualstudio.com/api/extension-guides/webview
2018-09-19 15:37:38 -07:00
- Sample: https://github.com/Microsoft/vscode-extension-samples/tree/master/webview-sample
2016-02-09 23:19:35 +01:00
# CSS Properties Preview Sample
2018-09-19 15:37:38 -07:00
2016-05-20 11:54:15 +02:00
This is an sample extension that illustrates the use of virtual documents or `TextDocumentContentProviders` together with the `vscode.previewHtml`
2018-12-21 10:06:05 -08:00
[command ](https://code.visualstudio.com/api/references/commands#commands ).
2016-02-09 23:19:35 +01:00
It is not intended as a product quality extension.
The purpose of the extension is to show a preview of the properties in the declaration block of a CSS rule. To play with the extension:
2018-09-19 15:37:38 -07:00
2016-02-09 23:19:35 +01:00
- Open a CSS file
- Use `Show CSS Properties Preview`
- Position the cursor inside the declaration block of the rule
- The properties are rendered in the preview
2016-07-29 12:06:56 +02:00
- Edit the properties and the preview is updated
2016-02-09 23:19:35 +01:00
2016-02-10 10:44:55 +01:00

2016-02-09 23:19:35 +01:00
# How it works
2018-12-16 21:08:20 -08:00
- The extension implements and registers a [`TextDocumentContentProvider` ](https://code.visualstudio.com/api/references/vscode-api#TextDocumentContentProvider ) for a particular URI scheme.
2016-05-20 11:54:15 +02:00
- The content provider creates a HTML document that contains the declaration block of the selected CSS rule in the active editor.
- The generated HTML document contains a link that invokes a contributed command to highlight the CSS rule in the source editor
- The generated HTML document is then opened in an editor in the 2nd Column using the command `vscode.previewHtml` .
2016-02-09 23:19:35 +01:00
2016-06-08 08:18:48 +02:00
# How to run locally
2016-02-09 23:19:35 +01:00
2018-09-19 15:37:38 -07:00
- `npm install`
- `npm run compile` to start the compiler in watch mode
- open this folder in VS Code and press `F5`