mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
[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>
This commit is contained in:
parent
c6dcedb911
commit
b07884c958
4 changed files with 29 additions and 9 deletions
19
searx/static/themes/simple/svg4web.svgo.js
Normal file
19
searx/static/themes/simple/svg4web.svgo.js
Normal file
|
|
@ -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'
|
||||
],
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue