From bf52353a5c3d0ba7bebde209c916d492fe521159 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 7 Nov 2021 16:45:00 +0100 Subject: [PATCH] [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 --- searx/static/themes/simple/gruntfile.js | 15 ++++++++++++++- searx/static/themes/simple/package.json | 2 ++ .../__common__/searxng-wordmark.min.svg | Bin 0 -> 2357 bytes utils/lib_static.sh | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 searx/templates/__common__/searxng-wordmark.min.svg diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index 325a973b4..f10d00cf3 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -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' ]); diff --git a/searx/static/themes/simple/package.json b/searx/static/themes/simple/package.json index 4b0ffc4fd..4ef608db7 100644 --- a/searx/static/themes/simple/package.json +++ b/searx/static/themes/simple/package.json @@ -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", diff --git a/searx/templates/__common__/searxng-wordmark.min.svg b/searx/templates/__common__/searxng-wordmark.min.svg new file mode 100644 index 0000000000000000000000000000000000000000..35b4cac25e6cee9a57e8ebbea505a4c8f34296eb GIT binary patch literal 2357 zcmbtV+iv4F5d9T_dD);A#f$E1d4VEbps(94`dBa$Z3~e^gQDYjzrHiFs3=Gt+OA+j z(%d+6&dg~0<)!a}XKlyU3>D#&kw6c%Y1-jXkw3qG4RaEVP7RIf%%CeW81iKoY{%zA z0G`8GHg!dg&Yj9AI-PAtjXgw79qCT@dT?XJDUZl(Tff@YRx8&&>)Q0a8OF(N81KBL zZT3sp%jH5ZaQAA8cLWE!uj@QAdmvH3=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