summaryrefslogtreecommitdiff
path: root/searx/static/themes/simple/svg4web.svgo.js
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-11-14 13:26:12 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-11-15 14:51:55 +0100
commitb07884c95864a074b700d635c92a43f734cc8868 (patch)
tree763232b47e5bd60fbd45553323ae5535ef6bf492 /searx/static/themes/simple/svg4web.svgo.js
parentc6dcedb911b0fc3c0982fcf8294a19389e5a2ac9 (diff)
[fix] Optimize SVG for WEB usage / CSP 'style-src self'
- Replace grunt-contrib-htmlmin by grunt-image [1]. - Activate svgo's [2] convertStyleToAttrs to make the HTML inline SVGs compoliant to the CSP policy [3]:: Content-Security-Policy: style-src self; [1] https://www.npmjs.com/package/grunt-image [2] https://github.com/svg/svgo [3] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src Closes: https://github.com/searxng/searxng/issues/502 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/static/themes/simple/svg4web.svgo.js')
-rw-r--r--searx/static/themes/simple/svg4web.svgo.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/searx/static/themes/simple/svg4web.svgo.js b/searx/static/themes/simple/svg4web.svgo.js
new file mode 100644
index 000000000..5b985adfe
--- /dev/null
+++ b/searx/static/themes/simple/svg4web.svgo.js
@@ -0,0 +1,19 @@
+/**
+ * @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',
+ // Optimize SVG for WEB usage
+ 'convertStyleToAttrs',
+ 'removeXMLNS'
+ ],
+};