From 757ebb5d9fdc24757f199e52575f32f6faf091b3 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 25 Mar 2020 14:09:47 +0100 Subject: [PATCH] [fix] brands: add variables from build env to grunt process We have some variables in the build environment which are also needed in the grunt process when building themes. Theses variables are relavant if one creates a fork with its own branding. We treat these variables under the term 'brands'. Signed-off-by: Markus Heiser --- Makefile | 15 +++++++++++++++ docs/dev/quickstart.rst | 6 +++--- manage.sh | 10 ---------- searx/static/themes/oscar/gruntfile.js | 4 +--- searx/static/themes/simple/gruntfile.js | 6 +++--- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 3b2d499e8..4914a309e 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,7 @@ help: @echo ' gh-pages - build docs & deploy on gh-pages branch' @echo ' clean - drop builds and environments' @echo ' project - re-build generic files of the searx project' + @echo ' themes - re-build build the source of the themes' @echo '' @$(MAKE) -s -f utils/makefile.include make-help @echo '' @@ -87,6 +88,20 @@ searx.brand: $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py +# build themes +# ------------ + +PHONY += themes themes.oscar themes.simple +themes: themes.oscar themes.simple + +themes.oscar: + $(Q)echo '[!] Grunt build : oscar theme' + $(Q)grunt --gruntfile "searx/static/themes/oscar/gruntfile.js" + +themes.simple: + $(Q)echo '[!] Grunt build : simple theme' + $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js" + # test # ---- diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst index e40772b3b..cb079a753 100644 --- a/docs/dev/quickstart.rst +++ b/docs/dev/quickstart.rst @@ -87,8 +87,8 @@ After satisfying the requirements styles can be build using ``manage.sh`` ./manage.sh styles -How to build the source of the oscar theme -========================================== +How to build the source of the themes +===================================== .. _grunt: https://gruntjs.com/ @@ -104,7 +104,7 @@ After installing grunt, the files can be built using the following command: .. code:: sh - ./manage.sh grunt_build + make themes Tips for debugging/development diff --git a/manage.sh b/manage.sh index 496a522ba..0551f02d3 100755 --- a/manage.sh +++ b/manage.sh @@ -156,15 +156,6 @@ styles() { build_style less/bootstrap/bootstrap.less css/bootstrap.min.css } -grunt_build() { - npm_path_setup - - echo '[!] Grunt build : oscar theme' - grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js" - echo '[!] Grunt build : simple theme' - grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js" -} - docker_build() { # Check if it is a git repository if [ ! -d .git ]; then @@ -257,7 +248,6 @@ Commands ----- locales - Compile locales styles - Build less files - grunt_build - Build files for themes docker_build - Build Docker image Tests diff --git a/searx/static/themes/oscar/gruntfile.js b/searx/static/themes/oscar/gruntfile.js index def035dba..606b6bcfb 100644 --- a/searx/static/themes/oscar/gruntfile.js +++ b/searx/static/themes/oscar/gruntfile.js @@ -13,7 +13,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' }, dist: { files: { @@ -38,7 +38,6 @@ module.exports = function(grunt) { development: { options: { paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"] - //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' }, files: {"css/pointhi.css": "less/pointhi/oscar.less", "css/logicodev.css": "less/logicodev-dark/oscar.less", @@ -47,7 +46,6 @@ module.exports = function(grunt) { production: { options: { paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"], - //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n', cleancss: true }, files: {"css/pointhi.min.css": "less/pointhi/oscar.less", diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js index c372ec730..c8f2ed3c6 100644 --- a/searx/static/themes/simple/gruntfile.js +++ b/searx/static/themes/simple/gruntfile.js @@ -36,7 +36,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n', + banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n', output: { comments: 'some' }, @@ -57,7 +57,7 @@ module.exports = function(grunt) { development: { options: { paths: ["less"], - banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' }, files: { "css/searx.css": "less/style.less", @@ -73,7 +73,7 @@ module.exports = function(grunt) { compatibility: '*' }) ], - banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n' + banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n' }, files: { "css/searx.min.css": "less/style.less",