Browse Source

[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>
Markus Heiser 3 years ago
parent
commit
bf52353a5c

+ 14 - 1
searx/static/themes/simple/gruntfile.js

@@ -9,7 +9,7 @@ module.exports = function(grunt) {
     watch: {
     watch: {
       scripts: {
       scripts: {
         files: ['src/**'],
         files: ['src/**'],
-        tasks: ['eslint', 'copy', 'concat', 'uglify', 'less:development', 'less:production']
+        tasks: ['eslint', 'copy', 'concat', 'uglify', 'htmlmin', 'less:development', 'less:production']
       }
       }
     },
     },
     eslint: {
     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: {
     webfont: {
       icons: {
       icons: {
         // src: 'node_modules/ionicons-npm/src/*.svg',
         // src: 'node_modules/ionicons-npm/src/*.svg',
@@ -191,6 +202,7 @@ module.exports = function(grunt) {
   grunt.loadNpmTasks('grunt-contrib-watch');
   grunt.loadNpmTasks('grunt-contrib-watch');
   grunt.loadNpmTasks('grunt-contrib-copy');
   grunt.loadNpmTasks('grunt-contrib-copy');
   grunt.loadNpmTasks('grunt-contrib-uglify');
   grunt.loadNpmTasks('grunt-contrib-uglify');
+  grunt.loadNpmTasks('grunt-contrib-htmlmin');
   grunt.loadNpmTasks('grunt-contrib-jshint');
   grunt.loadNpmTasks('grunt-contrib-jshint');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-contrib-less');
   grunt.loadNpmTasks('grunt-contrib-less');
@@ -207,6 +219,7 @@ module.exports = function(grunt) {
     'copy',
     'copy',
     'concat',
     'concat',
     'uglify',
     'uglify',
+    'htmlmin',
     'less:development',
     'less:development',
     'less:production'
     'less:production'
   ]);
   ]);

+ 2 - 0
searx/static/themes/simple/package.json

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

File diff suppressed because it is too large
+ 0 - 0
searx/templates/__common__/searxng-wordmark.min.svg


+ 1 - 0
utils/lib_static.sh

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

Some files were not shown because too many files changed in this diff