Skip to content

Commit 0c89df9

Browse files
authored
Merge pull request #1482 from github/koesie10/bundle-codicons
Bundle Codicons using Webpack
2 parents ac74b96 + ba8b320 commit 0c89df9

File tree

6 files changed

+126
-10
lines changed

6 files changed

+126
-10
lines changed

extensions/ql-vscode/gulpfile.ts/webpack.config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,21 @@ export const config: webpack.Configuration = {
5555
loader: 'css-loader'
5656
}
5757
]
58+
},
59+
{
60+
test: /\.(woff(2)?|ttf|eot)$/,
61+
use: [
62+
{
63+
loader: 'file-loader',
64+
options: {
65+
name: '[name].[ext]',
66+
outputPath: 'fonts/',
67+
// We need this to make Webpack use the correct path for the fonts.
68+
// Without this, the CSS file will use `url([object Module])`
69+
esModule: false
70+
}
71+
},
72+
],
5873
}
5974
]
6075
},

extensions/ql-vscode/package-lock.json

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,7 @@
12781278
"del": "^6.0.0",
12791279
"eslint": "~6.8.0",
12801280
"eslint-plugin-react": "~7.19.0",
1281+
"file-loader": "^6.2.0",
12811282
"glob": "^7.1.4",
12821283
"gulp": "^4.0.2",
12831284
"gulp-replace": "^1.1.3",

extensions/ql-vscode/src/abstract-interface-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ export abstract class AbstractInterfaceManager<ToMessage extends WebviewMessage,
5555
localResourceRoots: [
5656
...(config.additionalOptions?.localResourceRoots ?? []),
5757
Uri.file(tmpDir.name),
58-
Uri.file(path.join(ctx.extensionPath, 'out')),
59-
Uri.file(path.join(ctx.extensionPath, 'node_modules/@vscode/codicons/dist')),
58+
Uri.file(path.join(ctx.extensionPath, 'out'))
6059
],
6160
}
6261
);

extensions/ql-vscode/src/interface-utils.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,8 @@ export function getHtmlForWebview(
138138
ctx.asAbsolutePath('out/webview.js')
139139
);
140140

141-
// Allows use of the VS Code "codicons" icon set.
142-
// See https://github.com/microsoft/vscode-codicons
143-
const codiconsPathOnDisk = Uri.file(
144-
ctx.asAbsolutePath('node_modules/@vscode/codicons/dist/codicon.css')
145-
);
146-
147141
const stylesheetUrisOnDisk = [
148-
Uri.file(ctx.asAbsolutePath('out/webview.css')),
149-
codiconsPathOnDisk
142+
Uri.file(ctx.asAbsolutePath('out/webview.css'))
150143
];
151144

152145
// Convert the on-disk URIs into webview URIs.

extensions/ql-vscode/src/view/webview.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { vscode } from './vscode-api';
33

44
import { WebviewDefinition } from './webview-interface';
55

6+
// Allow all views to use Codicons
7+
import '@vscode/codicons/dist/codicon.css';
8+
69
const render = () => {
710
const element = document.getElementById('root');
811

0 commit comments

Comments
 (0)