[enh] minify searxng-wordmark.svg (HTMLMinifier)

Command::

  ./node_modules/.bin/html-minifier \
      --remove-comments \
      --collapse-whitespace \
      src/svg/searxng-wordmark.svg \
      -o ../../../templates/__common__/searxng-wordmark.min.svg

- html-minifier: https://github.com/kangax/html-minifier
  - onilne: https://kangax.github.io/html-minifier
  - grunt: https://www.npmjs.com/package/grunt-contrib-htmlmin
  - grunt-contrib-htmlmin: https://github.com/gruntjs/grunt-contrib-htmlmin
  - npm: https://www.npmjs.com/package/html-minifier

To test, rebuild your node environment::

  make node.env

Alternatives:

- pretty-data: https://github.com/vkiryukhin/pretty-data
  - grunt: https://www.npmjs.com/package/grunt-xmlmin
  - grunt-xmlming: https://github.com/dtrunk90/grunt-xmlmin
  - npm: https://www.npmjs.com/package/grunt-xmlmin

- minify-xml: https://github.com/kristian/minify-xml
  - no grunt package available
  - npm: https://www.npmjs.com/package/minify-xml

src/svg/searxng-wordmark.svg':
'../../../templates/__common__/searxng-wordmark.min.svg'

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-11-07 16:45:00 +01:00
parent edb081638b
commit bf52353a5c
4 changed files with 18 additions and 1 deletions

View File

@ -9,7 +9,7 @@ module.exports = function(grunt) {
watch: {
scripts: {
files: ['src/**'],
tasks: ['eslint', 'copy', 'concat', 'uglify', 'less:development', 'less:production']
tasks: ['eslint', 'copy', 'concat', 'uglify', 'htmlmin', 'less:development', 'less:production']
}
},
eslint: {
@ -95,6 +95,17 @@ module.exports = function(grunt) {
}
}
},
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true
},
files: {
'../../../templates/__common__/searxng-wordmark.min.svg': 'src/svg/searxng-wordmark.svg'
}
}
},
webfont: {
icons: {
// src: 'node_modules/ionicons-npm/src/*.svg',
@ -191,6 +202,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-less');
@ -207,6 +219,7 @@ module.exports = function(grunt) {
'copy',
'concat',
'uglify',
'htmlmin',
'less:development',
'less:production'
]);

View File

@ -8,6 +8,8 @@
"grunt-contrib-jshint": "~3.1.1",
"grunt-contrib-less": "~3.0.0",
"grunt-contrib-uglify": "~5.0.1",
"grunt-xmlmin": "~0.1.8",
"grunt-contrib-htmlmin": "~3.1.0",
"grunt-contrib-watch": "~1.1.0",
"grunt-stylelint": "^0.16.0",
"grunt-eslint": "^23.0.0",

View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="92mm" height="92mm" viewBox="0 0 92 92" version="1.1" id="svg8" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)" sodipodi:docname="searxng_wordmark.svg"><defs id="defs2"/><sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.1652357" inkscape:cx="8.758032" inkscape:cy="-147.71707" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1920" inkscape:window-height="1536" inkscape:window-x="1920" inkscape:window-y="27" inkscape:window-maximized="0"/><metadata id="metadata5"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title></dc:title></cc:Work></rdf:RDF></metadata><g inkscape:label="Ebene 1" inkscape:groupmode="layer" id="layer1" transform="translate(-40.921303,-17.416526)"><circle id="path3713" cx="75" cy="92" style="fill:none;stroke:#000000;stroke-width:12;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" r="0"/><circle style="fill:none;fill-opacity:1;stroke:#3050ff;stroke-width:10;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path834" cx="75.921303" cy="53.902557" r="30"/><path style="fill:none;fill-opacity:1;stroke:#3050ff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path852" sodipodi:type="arc" sodipodi:cx="75.785614" sodipodi:cy="53.902561" sodipodi:rx="18" sodipodi:ry="18" sodipodi:start="4.2349715" sodipodi:end="0.48572967" sodipodi:open="true" d="m 67.514849,37.91524 a 18,18 0 0 1 21.051475,3.312407 18,18 0 0 1 3.137312,21.078282"/><rect style="opacity:1;fill:#3050ff;fill-opacity:1;stroke:none;stroke-width:8;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="rect912" width="18.846331" height="39.963303" x="3.7063529" y="122.08995" ry="1.8669105e-13" transform="rotate(-46.234709)"/></g></svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -11,6 +11,7 @@ STATIC_BUILT_PATHS=(
searx/static/themes/simple/css
searx/static/themes/simple/js
searx/static/themes/simple/src/generated/pygments.less
searx/templates/__common__/searxng-wordmark.min.svg
)
static_help(){