[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
1 changed files with 29 additions and 19 deletions

View File

@ -2,8 +2,6 @@
module.exports = function(grunt) { module.exports = function(grunt) {
const path = require('path');
grunt.initConfig({ grunt.initConfig({
_brand: '../../../../src/brand', _brand: '../../../../src/brand',
@ -13,7 +11,16 @@ module.exports = function(grunt) {
watch: { watch: {
scripts: { scripts: {
files: ['gruntfile.js', 'src/**'], 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: { eslint: {
@ -78,14 +85,18 @@ module.exports = function(grunt) {
}, },
files: { files: {
'js/searxng.head.js': ['src/js/head/*.js'], '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: { uglify: {
options: { options: {
output: { output: {
comments: 'some' comments: 'some'
}, },
ie8: false, ie8: false,
warnings: true, 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: { less: {
development: { development: {
options: { 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: { svg2jinja: {
all: { all: {
src: { src: {
@ -165,7 +176,6 @@ module.exports = function(grunt) {
}, },
}); });
grunt.registerMultiTask('svg2jinja', 'Create Jinja2 macro', function() { grunt.registerMultiTask('svg2jinja', 'Create Jinja2 macro', function() {
const ejs = require('ejs'), svgo = require('svgo'); const ejs = require('ejs'), svgo = require('svgo');
const icons = {} const icons = {}
@ -240,10 +250,10 @@ module.exports = function(grunt) {
'stylelint', 'stylelint',
'copy', 'copy',
'concat', 'concat',
'svg2jinja',
'uglify', 'uglify',
'image',
'less:development', 'less:development',
'less:production' 'less:production',
'image',
'svg2jinja',
]); ]);
}; };