[mod] gruntfile: do some polish (no functional change)

- remove unused 'path' constant
- fix indentation
- Put all image tasks at the end, where it is easy to list which image is processed.

Suggested -by: @dalf https://github.com/searxng/searxng/pull/541#discussion_r756247157
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2021-11-25 10:03:12 +01:00
parent 11ba7f294f
commit 8c4c4259d4

View File

@ -2,8 +2,6 @@
module.exports = function(grunt) {
const path = require('path');
grunt.initConfig({
_brand: '../../../../src/brand',
@ -13,7 +11,16 @@ module.exports = function(grunt) {
watch: {
scripts: {
files: ['gruntfile.js', 'src/**'],
tasks: ['eslint', 'copy', 'concat', 'svg2jinja', 'uglify', 'image', 'less:development', 'less:production']
tasks: [
'eslint',
'copy',
'concat',
'uglify',
'less:development',
'less:production',
'image',
'svg2jinja'
]
}
},
eslint: {
@ -78,14 +85,18 @@ module.exports = function(grunt) {
},
files: {
'js/searxng.head.js': ['src/js/head/*.js'],
'js/searxng.js': ['src/js/main/*.js', '../__common__/js/*.js', './node_modules/autocomplete-js/dist/autocomplete.js']
'js/searxng.js': [
'src/js/main/*.js',
'../__common__/js/*.js',
'./node_modules/autocomplete-js/dist/autocomplete.js'
]
}
}
},
uglify: {
options: {
output: {
comments: 'some'
comments: 'some'
},
ie8: false,
warnings: true,
@ -100,16 +111,6 @@ module.exports = function(grunt) {
}
}
},
image: {
svg4web: {
options: {
svgo: ['--config', 'svg4web.svgo.js']
},
files: {
'<%= _templates %>/__common__/searxng-wordmark.min.svg': '<%= _brand %>/searxng-wordmark.svg'
}
}
},
less: {
development: {
options: {
@ -137,6 +138,16 @@ module.exports = function(grunt) {
}
},
},
image: {
svg4web: {
options: {
svgo: ['--config', 'svg4web.svgo.js']
},
files: {
'<%= _templates %>/__common__/searxng-wordmark.min.svg': '<%= _brand %>/searxng-wordmark.svg'
}
}
},
svg2jinja: {
all: {
src: {
@ -165,7 +176,6 @@ module.exports = function(grunt) {
},
});
grunt.registerMultiTask('svg2jinja', 'Create Jinja2 macro', function() {
const ejs = require('ejs'), svgo = require('svgo');
const icons = {}
@ -240,10 +250,10 @@ module.exports = function(grunt) {
'stylelint',
'copy',
'concat',
'svg2jinja',
'uglify',
'image',
'less:development',
'less:production'
'less:production',
'image',
'svg2jinja',
]);
};