Skip to content

Commit

Permalink
Inline codicons font for simple browser (#176462)
Browse files Browse the repository at this point in the history
Should fix #139674 but need to confirm on deployed codespaces
  • Loading branch information
mjbvz committed Mar 8, 2023
1 parent 7114851 commit b2ea6aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 7 additions & 12 deletions extensions/simple-browser/esbuild-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
// @ts-check
const path = require('path');
const fs = require('fs');
const esbuild = require('esbuild');

const args = process.argv.slice(2);
Expand All @@ -21,18 +20,14 @@ const srcDir = path.join(__dirname, 'preview-src');
const outDir = path.join(outputRoot, 'media');

async function build() {
fs.copyFileSync(
path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'),
path.join(outDir, 'codicon.css'));

fs.copyFileSync(
path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.ttf'),
path.join(outDir, 'codicon.ttf'));

await esbuild.build({
entryPoints: [
path.join(srcDir, 'index.ts')
],
entryPoints: {
'index': path.join(srcDir, 'index.ts'),
'codicon': path.join(__dirname, 'node_modules', 'vscode-codicons', 'dist', 'codicon.css'),
},
loader: {
'.ttf': 'dataurl',
},
bundle: true,
minify: true,
sourcemap: false,
Expand Down
2 changes: 1 addition & 1 deletion extensions/simple-browser/src/simpleBrowserView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class SimpleBrowserView extends Disposable {
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
font-src ${this._webviewPanel.webview.cspSource};
font-src data:;
style-src ${this._webviewPanel.webview.cspSource};
script-src 'nonce-${nonce}';
frame-src *;
Expand Down

0 comments on commit b2ea6aa

Please sign in to comment.