summaryrefslogtreecommitdiff
path: root/client/simple/vite.config.js
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2025-02-01 17:36:16 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-02-28 12:27:41 +0100
commit30ee34d3ea5fc6cb25a96c5e30cdb952253ec697 (patch)
treeaf5e655cc967dc33ac39eb266ea48e377d8e1ead /client/simple/vite.config.js
parenta207f5d0353d61e43d3140db1243ce003cd0c46b (diff)
[web-client] simple theme: vite plugins plg_svg2png & plg_svg2svg
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'client/simple/vite.config.js')
-rw-r--r--client/simple/vite.config.js50
1 files changed, 48 insertions, 2 deletions
diff --git a/client/simple/vite.config.js b/client/simple/vite.config.js
index 4c3c3b566..edf3b1f80 100644
--- a/client/simple/vite.config.js
+++ b/client/simple/vite.config.js
@@ -6,6 +6,8 @@ import { resolve } from "node:path";
import { defineConfig } from "vite";
import stylelint from "vite-plugin-stylelint";
import { viteStaticCopy } from "vite-plugin-static-copy";
+import { plg_svg2png } from "./tools/plg.js";
+import { plg_svg2svg } from "./tools/plg.js";
const ROOT = "../.."; // root of the git reposetory
@@ -23,7 +25,19 @@ const PATH = {
templates: resolve(ROOT, "searx/templates/simple"),
};
+const svg2svg_opts = {
+ plugins: [
+ { name: "preset-default" },
+ "sortAttrs",
+ "convertStyleToAttrs",
+ ]
+};
+const svg2svg_favicon_opts = {
+ plugins: [
+ { name: "preset-default" },
+ "sortAttrs",
+ ]
};
@@ -121,8 +135,40 @@ export default defineConfig({
{ src: PATH.leaflet + "/*.{css,css.map}", dest: PATH.dist + "/css" },
{ src: PATH.static + "/**/*", dest: PATH.dist },
]
- })
- ],
+ }),
+
+ // SearXNG brand (static)
+
+ plg_svg2png(
+ [
+ { src: PATH.brand + "/searxng-wordmark.svg", dest: PATH.dist + "/img/favicon.png" },
+ { src: PATH.brand + "/searxng.svg", dest: PATH.dist + "/img/searxng.png" },
+ ],
+ ),
+
+ // -- svg
+ plg_svg2svg(
+ [
+ { src: PATH.brand + "/searxng.svg", dest: PATH.dist + "/img/searxng.svg" },
+ { src: PATH.brand + "/img_load_error.svg", dest: PATH.dist + "/img/img_load_error.svg" },
+ ],
+ svg2svg_opts,
+ ),
+
+ // -- favicon
+ plg_svg2svg(
+ [ { src: PATH.brand + "/searxng-wordmark.svg", dest: PATH.dist + "/img/favicon.svg" } ],
+ svg2svg_favicon_opts,
+ ),
+
+ // -- simple templates
+ plg_svg2svg(
+ [
+ { src: PATH.brand + "/searxng-wordmark.svg", dest: PATH.templates + "/searxng-wordmark.min.svg" },
+ ],
+ svg2svg_opts
+ ),
+
] // end: plugins
});