summaryrefslogtreecommitdiff
path: root/client/simple
diff options
context:
space:
mode:
authorRuben D. <ruben@winterrific.net>2026-03-16 20:32:36 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2026-03-24 20:21:27 +0100
commit5e8255f28aa4969c3015a305bc83f63f70741627 (patch)
tree0bf7a0ef2353900a94f3cdf3b584e2eaaa4f42b2 /client/simple
parent3dc4d5daa88830595c1c42bf5dc722b6d3565767 (diff)
[MOD] generate manifest PWA icons (#5859)
Diffstat (limited to 'client/simple')
-rw-r--r--client/simple/tools/img.ts7
-rw-r--r--client/simple/tools/plg.ts6
-rw-r--r--client/simple/vite.config.ts22
3 files changed, 32 insertions, 3 deletions
diff --git a/client/simple/tools/img.ts b/client/simple/tools/img.ts
index 03add435f..62d7ba7ac 100644
--- a/client/simple/tools/img.ts
+++ b/client/simple/tools/img.ts
@@ -18,8 +18,10 @@ export type Src2Dest = {
* Convert a list of SVG files to PNG.
*
* @param items - Array of SVG files (src: SVG, dest:PNG) to convert.
+ * @param width - (optional) width of the PNG pictures
+ * @param height - (optional) height of the PNG pictures.
*/
-export const svg2png = (items: Src2Dest[]): void => {
+export const svg2png = (items: Src2Dest[], width?: number, height?: number): void => {
for (const item of items) {
fs.mkdirSync(path.dirname(item.dest), { recursive: true });
@@ -29,6 +31,9 @@ export const svg2png = (items: Src2Dest[]): void => {
compressionLevel: 9,
palette: true
})
+ .resize(width, height, {
+ fit: "contain"
+ })
.toFile(item.dest)
.then((info) => {
console.log(`[svg2png] created ${item.dest} -- bytes: ${info.size}, w:${info.width}px, h:${info.height}px`);
diff --git a/client/simple/tools/plg.ts b/client/simple/tools/plg.ts
index b5ff6e8f6..2ca96ccac 100644
--- a/client/simple/tools/plg.ts
+++ b/client/simple/tools/plg.ts
@@ -17,13 +17,15 @@ import { type Src2Dest, svg2png, svg2svg } from "./img.ts";
* Vite plugin to convert a list of SVG files to PNG.
*
* @param items - Array of SVG files (src: SVG, dest:PNG) to convert.
+ * @param width - (optional) width of the PNG picture
+ * @param height - (optional) height of the PNG picture
*/
-export const plg_svg2png = (items: Src2Dest[]): Plugin => {
+export const plg_svg2png = (items: Src2Dest[], width?: number, height?: number): Plugin => {
return {
name: "searxng-simple-svg2png",
apply: "build",
writeBundle: () => {
- svg2png(items);
+ svg2png(items, width, height);
}
};
};
diff --git a/client/simple/vite.config.ts b/client/simple/vite.config.ts
index 34cb6cdfd..96230281d 100644
--- a/client/simple/vite.config.ts
+++ b/client/simple/vite.config.ts
@@ -132,6 +132,28 @@ export default {
}
]),
+ // SearXNG PWA Icons (static)
+ plg_svg2png(
+ [
+ {
+ src: `${PATH.brand}/searxng-wordmark.svg`,
+ dest: `${PATH.dist}/img/512.png`
+ }
+ ],
+ 512,
+ 512
+ ),
+ plg_svg2png(
+ [
+ {
+ src: `${PATH.brand}/searxng-wordmark.svg`,
+ dest: `${PATH.dist}/img/192.png`
+ }
+ ],
+ 192,
+ 192
+ ),
+
// -- svg
plg_svg2svg(
[