Browse Source

[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 <markus.heiser@darmarit.de>
Markus Heiser 5 years ago
parent
commit
757ebb5d9f
5 changed files with 22 additions and 19 deletions
  1. 15 0
      Makefile
  2. 3 3
      docs/dev/quickstart.rst
  3. 0 10
      manage.sh
  4. 1 3
      searx/static/themes/oscar/gruntfile.js
  5. 3 3
      searx/static/themes/simple/gruntfile.js

+ 15 - 0
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
 # ----
 

+ 3 - 3
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

+ 0 - 10
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

+ 1 - 3
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",

+ 3 - 3
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",