Created
May 7, 2020 14:29
-
-
Save GrandSchtroumpf/055e65f118e4c94c676f4494cd7a5d20 to your computer and use it in GitHub Desktop.
Markdium-VSCode extension inside a nx workspace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const index = join(context.extensionPath, 'studio/index.html'); | |
// Refresh the webview on update from the code | |
const updateWebview = async () => { | |
const html = await fs.readFile(index, 'utf-8'); | |
panel.webview.html = html.replace(matchLinks, toUri); | |
} | |
// In dev mode listen on changes from index.html & update the view | |
if (!environment.production) { | |
watch(index).on('change', updateWebview) | |
} | |
// First render | |
updateWebview(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment