diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-06-17 10:46:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-17 10:46:50 +0200 |
| commit | 92c68fe636ede2b10a2b4d71c559a22969b38f6f (patch) | |
| tree | 6c41cde5c5d893be1f964a4d7d9c610b82a7360a /searx/static/themes/simple/gruntfile.js | |
| parent | a447c58218f953ab0d855408fac4b015fd8ea89c (diff) | |
| parent | ae677cb64b4456ee336bc62484cbf022e9d6493f (diff) | |
Merge pull request #151 from searxng/mod_oscar
make themes: 2 node_modules directories instead of 3
Diffstat (limited to 'searx/static/themes/simple/gruntfile.js')
| -rw-r--r-- | searx/static/themes/simple/gruntfile.js | 110 |
1 files changed, 73 insertions, 37 deletions
diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index 4c14116b2..1dea80bd4 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -6,12 +6,12 @@ module.exports = function(grunt) { pkg: grunt.file.readJSON('package.json'), watch: { scripts: { - files: ['<%= jshint.files %>', 'less/*.less'], + files: ['src/**'], tasks: ['jshint', 'concat', 'uglify', 'webfont', 'less:development', 'less:production'] } }, jshint: { - files: ['js/searx_src/*.js', 'js/searx_header/*.js', '../__common__/js/*.js'], + files: ['src/js/main/*.js', 'src/js/head/*.js', '../__common__/js/*.js'], options: { reporterOutput: "", proto: true, @@ -23,14 +23,49 @@ module.exports = function(grunt) { } } }, + copy: { + js: { + expand: true, + cwd: './node_modules', + dest: './js/', + flatten: true, + filter: 'isFile', + timestamp: true, + src: [ + './leaflet/dist/leaflet.js', + ] + }, + css: { + expand: true, + cwd: './node_modules', + dest: './css/', + flatten: true, + filter: 'isFile', + timestamp: true, + src: [ + './leaflet/dist/leaflet.css', + ] + }, + leaflet_images: { + expand: true, + cwd: './node_modules', + dest: './css/images/', + flatten: true, + filter: 'isFile', + timestamp: true, + src: [ + './leaflet/dist/images/*.png', + ] + }, + }, concat: { head_and_body: { options: { separator: ';' }, files: { - 'js/searx.head.js': ['js/searx_head/*.js'], - 'js/searx.js': ['js/searx_src/*.js', '../__common__/js/*.js'] + 'js/searx.head.js': ['src/js/head/*.js'], + 'js/searx.js': ['src/js/main/*.js', '../__common__/js/*.js', './node_modules/autocomplete-js/dist/autocomplete.js'] } } }, @@ -53,35 +88,6 @@ module.exports = function(grunt) { } } }, - less: { - development: { - options: { - paths: ["less"], - banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' - }, - files: { - "css/searx.css": "less/style.less", - "css/searx-rtl.css": "less/style-rtl.less" - } - }, - production: { - options: { - paths: ["less"], - plugins: [ - new (require('less-plugin-clean-css'))() - ], - sourceMap: true, - sourceMapURL: (name) => { const s = name.split('/'); return s[s.length - 1] + '.map';}, - outputSourceFiles: false, - sourceMapRootpath: '../', - banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' - }, - files: { - "css/searx.min.css": "less/style.less", - "css/searx-rtl.min.css": "less/style-rtl.less" - } - }, - }, webfont: { icons: { // src: 'node_modules/ionicons-npm/src/*.svg', @@ -107,11 +113,11 @@ module.exports = function(grunt) { 'node_modules/ionicons-npm/src/music-note.svg', 'node_modules/ionicons-npm/src/ion-close-round.svg', 'node_modules/ionicons-npm/src/android-more-vertical.svg', - 'magnet.svg', + 'src/fonts/magnet.svg', 'node_modules/ionicons-npm/src/android-close.svg', ], dest: 'fonts', - destLess: 'less', + destLess: '.', options: { font: 'ion', hashes : true, @@ -145,10 +151,40 @@ module.exports = function(grunt) { } } } - } + }, + less: { + development: { + options: { + paths: ["less"], + banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' + }, + files: { + "css/searx.css": "src/less/style.less", + "css/searx-rtl.css": "src/less/style-rtl.less" + } + }, + production: { + options: { + paths: ["less"], + plugins: [ + new (require('less-plugin-clean-css'))() + ], + sourceMap: true, + sourceMapURL: (name) => { const s = name.split('/'); return s[s.length - 1] + '.map';}, + outputSourceFiles: false, + sourceMapRootpath: '../', + banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' + }, + files: { + "css/searx.min.css": "src/less/style.less", + "css/searx-rtl.min.css": "src/less/style-rtl.less" + } + }, + }, }); grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-concat'); @@ -158,5 +194,5 @@ module.exports = function(grunt) { grunt.registerTask('test', ['jshint']); - grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'less:development', 'less:production']); + grunt.registerTask('default', ['jshint', 'copy', 'concat', 'uglify', 'webfont', 'less:development', 'less:production']); }; |