From 944b73511a3125212dc3d53f957bd5960c8fc0d0 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 28 Nov 2021 15:24:39 +0100 Subject: [PATCH] [enh] add SVG favicon href="favicon.svg" type="image/svg+xml" Add link:: Modern browsers should request:: INFO werkzeug : 127.0.0.1 - - [28/Nov/2021 17:03:07] "GET /static/themes/simple/img/favicon.svg HTTP/1.1" 200 - [1] https://github.com/audreyfeldroy/favicon-cheat-sheet#svg-file [2] https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7 Signed-off-by: Markus Heiser --- searx/static/themes/simple/gruntfile.js | 10 +++++++++- searx/static/themes/simple/svg4favicon.svgo.js | 16 ++++++++++++++++ searx/templates/simple/base.html | 3 ++- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 searx/static/themes/simple/svg4favicon.svgo.js diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index 8075e0797..b7501c732 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -150,7 +150,15 @@ module.exports = function(grunt) { '<%= _templates %>/__common__/searxng-wordmark.min.svg': '<%= _brand %>/searxng-wordmark.svg', 'img/searxng.svg': '<%= _brand %>/searxng.svg' } - } + }, + favicon: { + options: { + svgo: ['--config', 'svg4favicon.svgo.js'] + }, + files: { + 'img/favicon.svg': '<%= _brand %>/searxng-wordmark.svg' + } + }, }, svg2png: { favicon: { diff --git a/searx/static/themes/simple/svg4favicon.svgo.js b/searx/static/themes/simple/svg4favicon.svgo.js new file mode 100644 index 000000000..b9dd0da8e --- /dev/null +++ b/searx/static/themes/simple/svg4favicon.svgo.js @@ -0,0 +1,16 @@ +/** + * @license + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * svgo config: Optimize SVG for WEB usage + */ + +module.exports = { + plugins: [ + { + name: 'preset-default', + }, + // make diff friendly + 'sortAttrs', + ], +}; diff --git a/searx/templates/simple/base.html b/searx/templates/simple/base.html index 52a5e5192..bb1f51cad 100644 --- a/searx/templates/simple/base.html +++ b/searx/templates/simple/base.html @@ -31,7 +31,8 @@ {% block head %} {% endblock %} - + +