@vezham/icons-vscode 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscodeignore +3 -0
- package/CHANGELOG.md +19 -0
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/extension.js +122 -0
- package/package.json +89 -0
- package/resources/icon.png +0 -0
- package/scripts/build.cjs +93 -0
- package/src/ui.html +1112 -0
package/.vscodeignore
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @vezham/icons-vscode
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4bc7ae2`](https://github.com/vezham/reicon/commit/4bc7ae21342fe26c90359bc0d5cbb74258b32fe7) Thanks [@vx-vigneshwaran](https://github.com/vx-vigneshwaran)! - ver bump
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`345a93a`](https://github.com/vezham/reicon/commit/345a93aa6f5a5b7f0d4598a0708eb24dd704046a) Thanks [@vx-vigneshwaran](https://github.com/vx-vigneshwaran)! - ver bump
|
|
14
|
+
|
|
15
|
+
## 1.0.0
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`ccfadd2`](https://github.com/vezham/reicon/commit/ccfadd29b3031f81cc6986d9e2ff084eca798c81) Thanks [@vx-vigneshwaran](https://github.com/vx-vigneshwaran)! - init test
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dev Chauhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://reicon.dev">
|
|
3
|
+
<img src="https://reicon.dev/readme-banner.png" alt="Reicon for VS Code — SVG Icon Library for VS Code" width="100%" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://marketplace.visualstudio.com/items?itemName=DevChauhan.reicon"><img src="https://img.shields.io/visual-studio-marketplace/v/DevChauhan.reicon?color=black&label=marketplace" alt="VS Marketplace version" /></a>
|
|
9
|
+
<a href="https://marketplace.visualstudio.com/items?itemName=DevChauhan.reicon"><img src="https://img.shields.io/visual-studio-marketplace/d/DevChauhan.reicon?color=black&label=downloads" alt="VS Marketplace downloads" /></a>
|
|
10
|
+
<a href="https://github.com/dqev/reicon/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-black" alt="MIT License" /></a>
|
|
11
|
+
<a href="https://reicon.dev"><img src="https://img.shields.io/badge/docs-reicon.dev-black" alt="Documentation" /></a>
|
|
12
|
+
<a href="https://github.com/dqev/reicon"><img src="https://img.shields.io/badge/github-dqev/reicon-black" alt="GitHub" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<h1 align="center">Reicon for VS Code</h1>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<b>Browse and insert 2674+ Reicon icons</b> • Outline & Filled weights • React, Vue, Svelte, SVG, JSX • Smart code insertion
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="#features">Features</a> •
|
|
23
|
+
<a href="#quick-start">Quick Start</a> •
|
|
24
|
+
<a href="#configuration">Configuration</a> •
|
|
25
|
+
<a href="#related-packages">Related</a> •
|
|
26
|
+
<a href="#links">Links</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
**Reicon for VS Code** brings the official, pixel-perfect Reicon library directly into your code editor. Browse, search, customize, and insert icons instantly in multiple formats with zero context switching.
|
|
30
|
+
|
|
31
|
+
| 🔗 Resource | Link |
|
|
32
|
+
|---|---|
|
|
33
|
+
| 🌐 Website & icon browser | [reicon.dev](https://reicon.dev) |
|
|
34
|
+
| 📖 Documentation | [reicon.dev/docs](https://reicon.dev/docs) |
|
|
35
|
+
| 📦 Marketplage | [marketplace.visualstudio.com/items?itemName=DevChauhan.reicon](https://marketplace.visualstudio.com/items?itemName=DevChauhan.reicon) |
|
|
36
|
+
| 🎨 Figma plugin | [reicon.dev/docs/figma](https://reicon.dev/docs/figma) |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- **Activity Bar Panel** — A custom sidebar panel that houses the icon browser
|
|
43
|
+
- **2674+ Pixel-Perfect Icons** — Browse the complete collection in both **Outline** and **Filled** weights
|
|
44
|
+
- **Smart Code Insertion** — Click any icon to instantly insert it at your cursor in your preferred framework syntax:
|
|
45
|
+
- **React (JSX)**: `<Home size={24} color="#6c5ce7" />`
|
|
46
|
+
- **Vue**: `<Home :size="24" color="#6c5ce7" />`
|
|
47
|
+
- **Svelte**: `<Home size={24} color="#6c5ce7" />`
|
|
48
|
+
- **SVG**: Raw SVG code `<svg ...>...</svg>`
|
|
49
|
+
- **Live Customization** — Adjust size (in pixels) and color (using preset swatches or hex inputs) directly in the sidebar toolbar before inserting
|
|
50
|
+
- **Smart Theme Adaptation** — Automatically uses `currentColor` by default to match your VS Code theme
|
|
51
|
+
- **State Persistence** — Remembers your preferred format, color, size, and category choices between editor sessions
|
|
52
|
+
- **Clipboard Fallback** — Copies the formatted code snippet to your clipboard automatically if no text editor is currently active
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
1. Install the extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=DevChauhan.reicon)
|
|
59
|
+
2. Click the **Reicon** logo in the Activity Bar on the left
|
|
60
|
+
3. Search for icons by name, category, or description keywords
|
|
61
|
+
4. Set your preferred **Format** (React, Vue, Svelte, SVG), **Size**, and **Color**
|
|
62
|
+
5. Click on any icon grid card to instantly insert the code at your cursor
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Configuration
|
|
67
|
+
|
|
68
|
+
| Feature | Description |
|
|
69
|
+
|---------|-------------|
|
|
70
|
+
| **Search** | Press `Cmd+F` (Mac) / `Ctrl+F` (Win) when the panel is open to focus the search input |
|
|
71
|
+
| **Theme Color** | Use the `currentColor` option to match the surrounding text color |
|
|
72
|
+
| **Preview Size** | Use the button menu (top-right) to increase or decrease preview size |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Related packages
|
|
77
|
+
|
|
78
|
+
| Package | Description |
|
|
79
|
+
|---------|-------------|
|
|
80
|
+
| [`reicon`](https://npmjs.com/package/reicon) | Core vanilla JS + CDN runtime. No framework required. |
|
|
81
|
+
| [`reicon-react`](https://npmjs.com/package/reicon-react) | React components for 2674+ icons. |
|
|
82
|
+
| [`reicon-vue`](https://npmjs.com/package/reicon-vue) | Vue 3 components for 2674+ icons. |
|
|
83
|
+
| [`reicon-svelte`](https://npmjs.com/package/reicon-svelte) | Svelte components for 2674+ icons. |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Links
|
|
88
|
+
|
|
89
|
+
- 🌐 Website: [reicon.dev](https://reicon.dev)
|
|
90
|
+
- 📖 Documentation: [reicon.dev/docs](https://reicon.dev/docs)
|
|
91
|
+
- 🛍️ Marketplace: [marketplace.visualstudio.com/items?itemName=DevChauhan.reicon](https://marketplace.visualstudio.com/items?itemName=DevChauhan.reicon)
|
|
92
|
+
- 🐙 GitHub: [github.com/dqev/reicon](https://github.com/dqev/reicon)
|
|
93
|
+
- 🐛 Issues: [github.com/dqev/reicon/issues](https://github.com/dqev/reicon/issues)
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT © [Dev Chauhan](https://devchauhan.in)
|
|
100
|
+
|
|
101
|
+
Free to use in personal and commercial projects. Attribution is appreciated but not required.
|
package/extension.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const vscode = require('vscode');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param {vscode.ExtensionContext} context
|
|
7
|
+
*/
|
|
8
|
+
function activate(context) {
|
|
9
|
+
const provider = new ReiconWebviewViewProvider(context.extensionUri);
|
|
10
|
+
|
|
11
|
+
context.subscriptions.push(
|
|
12
|
+
vscode.window.registerWebviewViewProvider(ReiconWebviewViewProvider.viewType, provider)
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
context.subscriptions.push(
|
|
16
|
+
vscode.commands.registerCommand('reicon.focusExplorer', () => {
|
|
17
|
+
vscode.commands.executeCommand('workbench.view.extension.reicon-explorer');
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
class ReiconWebviewViewProvider {
|
|
23
|
+
static viewType = 'reicon.views.explorer';
|
|
24
|
+
|
|
25
|
+
constructor(extensionUri) {
|
|
26
|
+
this._extensionUri = extensionUri;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {vscode.WebviewView} webviewView
|
|
31
|
+
* @param {vscode.WebviewViewResolveContext} context
|
|
32
|
+
* @param {vscode.CancellationToken} _token
|
|
33
|
+
*/
|
|
34
|
+
resolveWebviewView(webviewView, context, _token) {
|
|
35
|
+
this._view = webviewView;
|
|
36
|
+
|
|
37
|
+
webviewView.webview.options = {
|
|
38
|
+
enableScripts: true,
|
|
39
|
+
localResourceRoots: [
|
|
40
|
+
this._extensionUri
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);
|
|
45
|
+
|
|
46
|
+
webviewView.webview.onDidReceiveMessage(data => {
|
|
47
|
+
switch (data.type) {
|
|
48
|
+
case 'insert-icon':
|
|
49
|
+
this._insertIcon(data.snippet, data.name);
|
|
50
|
+
break;
|
|
51
|
+
case 'open-url':
|
|
52
|
+
vscode.env.openExternal(vscode.Uri.parse(data.url));
|
|
53
|
+
break;
|
|
54
|
+
case 'show-toast':
|
|
55
|
+
vscode.window.showInformationMessage(data.message);
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {string} snippet
|
|
63
|
+
* @param {string} name
|
|
64
|
+
*/
|
|
65
|
+
_insertIcon(snippet, name) {
|
|
66
|
+
const editor = vscode.window.activeTextEditor;
|
|
67
|
+
if (!editor) {
|
|
68
|
+
// Fallback: Copy to clipboard if no editor is active
|
|
69
|
+
vscode.env.clipboard.writeText(snippet);
|
|
70
|
+
vscode.window.showInformationMessage(`No active editor. Copied "${name}" snippet to clipboard.`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
editor.edit(editBuilder => {
|
|
75
|
+
editBuilder.insert(editor.selection.active, snippet);
|
|
76
|
+
}).then(success => {
|
|
77
|
+
if (success) {
|
|
78
|
+
vscode.window.setStatusBarMessage(`Inserted Reicon "${name}"`, 3000);
|
|
79
|
+
} else {
|
|
80
|
+
vscode.window.showErrorMessage(`Failed to insert Reicon "${name}"`);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {vscode.Webview} webview
|
|
87
|
+
*/
|
|
88
|
+
_getHtmlForWebview(webview) {
|
|
89
|
+
const htmlPath = path.join(this._extensionUri.fsPath, 'dist', 'ui.html');
|
|
90
|
+
if (!fs.existsSync(htmlPath)) {
|
|
91
|
+
return `
|
|
92
|
+
<!DOCTYPE html>
|
|
93
|
+
<html lang="en">
|
|
94
|
+
<head>
|
|
95
|
+
<meta charset="UTF-8">
|
|
96
|
+
<title>Reicon Icons</title>
|
|
97
|
+
<style>
|
|
98
|
+
body {
|
|
99
|
+
font-family: sans-serif;
|
|
100
|
+
padding: 20px;
|
|
101
|
+
color: var(--vscode-editor-foreground, #cccccc);
|
|
102
|
+
background-color: var(--vscode-editor-background, #1e1e1e);
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
105
|
+
</head>
|
|
106
|
+
<body>
|
|
107
|
+
<h3>Reicon Webview file not found</h3>
|
|
108
|
+
<p>Please make sure you have run the build command inside the reicon-vscode directory.</p>
|
|
109
|
+
</body>
|
|
110
|
+
</html>
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
return fs.readFileSync(htmlPath, 'utf8');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function deactivate() {}
|
|
118
|
+
|
|
119
|
+
module.exports = {
|
|
120
|
+
activate,
|
|
121
|
+
deactivate
|
|
122
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vezham/icons-vscode",
|
|
3
|
+
"displayName": "Reicon — Open Source SVG Icon Library",
|
|
4
|
+
"description": "Browse and insert 2,700+ handcrafted Reicon SVG icons directly into your HTML, React, Vue, Svelte, or vanilla JS code. Outlined and filled styles available.",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"publisher": "DevChauhan",
|
|
7
|
+
"engines": {
|
|
8
|
+
"vscode": "^1.80.0"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"icons",
|
|
12
|
+
"svg",
|
|
13
|
+
"react-icons",
|
|
14
|
+
"lucide",
|
|
15
|
+
"heroicons",
|
|
16
|
+
"icon picker",
|
|
17
|
+
"icon browser",
|
|
18
|
+
"reicon",
|
|
19
|
+
"vue-icons",
|
|
20
|
+
"svelte-icons",
|
|
21
|
+
"outline icons",
|
|
22
|
+
"filled icons"
|
|
23
|
+
],
|
|
24
|
+
"categories": [
|
|
25
|
+
"Snippets",
|
|
26
|
+
"Other"
|
|
27
|
+
],
|
|
28
|
+
"galleryBanner": {
|
|
29
|
+
"color": "#09090b",
|
|
30
|
+
"theme": "dark"
|
|
31
|
+
},
|
|
32
|
+
"badges": [
|
|
33
|
+
{
|
|
34
|
+
"url": "https://img.shields.io/badge/icons-2,700%2B-blue",
|
|
35
|
+
"href": "https://reicon.dev",
|
|
36
|
+
"description": "2,700+ Icons"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"url": "https://img.shields.io/badge/license-MIT-6C5CE7",
|
|
40
|
+
"href": "https://github.com/vezham/reicon/blob/main/LICENSE",
|
|
41
|
+
"description": "MIT License"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"icon": "resources/icon.png",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/vezham/reicon",
|
|
49
|
+
"directory": "packages/icons-vscode"
|
|
50
|
+
},
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/vezham/reicon/issues"
|
|
53
|
+
},
|
|
54
|
+
"homepage": "https://vezham.com",
|
|
55
|
+
"activationEvents": [],
|
|
56
|
+
"main": "./extension.js",
|
|
57
|
+
"contributes": {
|
|
58
|
+
"viewsContainers": {
|
|
59
|
+
"activitybar": [
|
|
60
|
+
{
|
|
61
|
+
"id": "reicon-explorer",
|
|
62
|
+
"title": "Reicon",
|
|
63
|
+
"icon": "resources/icon.png"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"views": {
|
|
68
|
+
"reicon-explorer": [
|
|
69
|
+
{
|
|
70
|
+
"type": "webview",
|
|
71
|
+
"id": "reicon.views.explorer",
|
|
72
|
+
"name": "Reicon Icons"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"commands": [
|
|
77
|
+
{
|
|
78
|
+
"command": "reicon.focusExplorer",
|
|
79
|
+
"title": "Focus on Reicon Icons"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@types/vscode": "^1.80.0"
|
|
85
|
+
},
|
|
86
|
+
"scripts": {
|
|
87
|
+
"build": "node scripts/build.cjs"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const DATA_PATH = path.join(__dirname, '..', '..', '..', 'data', 'icon-data.json');
|
|
6
|
+
const TEMPLATE_HTML_PATH = path.join(__dirname, '..', 'src', 'ui.html');
|
|
7
|
+
const OUTPUT_HTML_PATH = path.join(__dirname, '..', 'dist', 'ui.html');
|
|
8
|
+
const LOGO_PATH = path.join(__dirname, '..', '..', '..', 'public', 'apple-touch-icon.png');
|
|
9
|
+
|
|
10
|
+
console.log('Compiling Reicon VS Code icons database and inlining into ui.html...');
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
if (!fs.existsSync(DATA_PATH)) {
|
|
14
|
+
throw new Error(`Data file not found at ${DATA_PATH}`);
|
|
15
|
+
}
|
|
16
|
+
if (!fs.existsSync(TEMPLATE_HTML_PATH)) {
|
|
17
|
+
throw new Error(`Template HTML file not found at ${TEMPLATE_HTML_PATH}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const rawData = JSON.parse(fs.readFileSync(DATA_PATH, 'utf-8'));
|
|
21
|
+
const compactData = {};
|
|
22
|
+
const categoriesList = [];
|
|
23
|
+
|
|
24
|
+
if (rawData.categories) {
|
|
25
|
+
for (const [catKey, catData] of Object.entries(rawData.categories)) {
|
|
26
|
+
categoriesList.push({
|
|
27
|
+
id: catKey,
|
|
28
|
+
name: catData.name || catKey.charAt(0).toUpperCase() + catKey.slice(1)
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
for (const [iconKey, icon] of Object.entries(catData.icons || {})) {
|
|
32
|
+
const weights = {};
|
|
33
|
+
if (icon.weights) {
|
|
34
|
+
if (icon.weights.Outline && icon.weights.Outline.code) {
|
|
35
|
+
weights.Outline = icon.weights.Outline.code;
|
|
36
|
+
}
|
|
37
|
+
if (icon.weights.Filled && icon.weights.Filled.code) {
|
|
38
|
+
weights.Filled = icon.weights.Filled.code;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Only include icon if it has at least one weight
|
|
43
|
+
if (Object.keys(weights).length > 0) {
|
|
44
|
+
compactData[iconKey] = {
|
|
45
|
+
category: catKey,
|
|
46
|
+
weights: weights,
|
|
47
|
+
description: icon.description || []
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Load logo as base64
|
|
55
|
+
let logoBase64 = '';
|
|
56
|
+
if (fs.existsSync(LOGO_PATH)) {
|
|
57
|
+
const logoBuffer = fs.readFileSync(LOGO_PATH);
|
|
58
|
+
logoBase64 = `data:image/png;base64,${logoBuffer.toString('base64')}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Read the HTML template
|
|
62
|
+
let templateContent = fs.readFileSync(TEMPLATE_HTML_PATH, 'utf-8');
|
|
63
|
+
|
|
64
|
+
// Replace placeholders
|
|
65
|
+
templateContent = templateContent.replace(/__REICON_LOGO_BASE64__/g, logoBase64);
|
|
66
|
+
|
|
67
|
+
// Create inline scripts
|
|
68
|
+
const inlineScripts = `
|
|
69
|
+
<script>
|
|
70
|
+
window.REICON_DATA = ${JSON.stringify(compactData)};
|
|
71
|
+
window.REICON_CATEGORIES = ${JSON.stringify(categoriesList)};
|
|
72
|
+
</script>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
// Inject before the closing </head> or at placeholder
|
|
76
|
+
if (templateContent.includes('<!-- INJECT_ICONS_DATA -->')) {
|
|
77
|
+
templateContent = templateContent.replace('<!-- INJECT_ICONS_DATA -->', inlineScripts);
|
|
78
|
+
} else {
|
|
79
|
+
templateContent = templateContent.replace('</head>', `${inlineScripts}\n</head>`);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Ensure output directory exists
|
|
83
|
+
const outputDir = path.dirname(OUTPUT_HTML_PATH);
|
|
84
|
+
if (!fs.existsSync(outputDir)) {
|
|
85
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
fs.writeFileSync(OUTPUT_HTML_PATH, templateContent, 'utf-8');
|
|
89
|
+
console.log(`Successfully compiled ${Object.keys(compactData).length} icons directly into ${OUTPUT_HTML_PATH}`);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
console.error('Error compiling VS Code extension UI:', error);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|