on master help sign in
[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>

commit757ebb5d9fdc24757f199e52575f32f6faf091b3 authorMarkus Heiser <markus.heiser@darmarit.de> dateWed 25 Mar 2020, 14:09 (7 years ago) parentaaf22ba
5 files changed+22−19
Makefile+15 docs/dev/quickstart.rst+3−3 manage.sh−10 searx/static/themes/oscar/gruntfile.js+1−3 searx/static/themes/simple/gruntfile.js+3−3
Makefile+15
@@ -28,6 +28,7 @@ help:
2828 @echo ' gh-pages - build docs & deploy on gh-pages branch'
2929 @echo ' clean - drop builds and environments'
3030 @echo ' project - re-build generic files of the searx project'
31+ @echo ' themes - re-build build the source of the themes'
3132 @echo ''
3233 @$(MAKE) -s -f utils/makefile.include make-help
3334 @echo ''
@@ -87,6 +88,20 @@ searx.brand:
8788 $(Q)echo "DOCS_URL = '$(DOCS_URL)'" >> searx/brand.py
8889 $(Q)echo "PUBLIC_INSTANCES = 'https://searx.space'" >> searx/brand.py
8990
91+# build themes
92+# ------------
93+
94+PHONY += themes themes.oscar themes.simple
95+themes: themes.oscar themes.simple
96+
97+themes.oscar:
98+ $(Q)echo '[!] Grunt build : oscar theme'
99+ $(Q)grunt --gruntfile "searx/static/themes/oscar/gruntfile.js"
100+
101+themes.simple:
102+ $(Q)echo '[!] Grunt build : simple theme'
103+ $(Q)grunt --gruntfile "searx/static/themes/simple/gruntfile.js"
104+
90105# test
91106# ----
92107
docs/dev/quickstart.rst+3−3
@@ -87,8 +87,8 @@ After satisfying the requirements styles can be build using ``manage.sh``
8787 ./manage.sh styles
8888
8989
90−How to build the source of the oscar theme
91−==========================================
90+How to build the source of the themes
91+=====================================
9292
9393.. _grunt: https://gruntjs.com/
9494
@@ -104,7 +104,7 @@ After installing grunt, the files can be built using the following command:
104104
105105.. code:: sh
106106
107− ./manage.sh grunt_build
107+ make themes
108108
109109
110110Tips for debugging/development
manage.sh−10
@@ -156,15 +156,6 @@ styles() {
156156 build_style less/bootstrap/bootstrap.less css/bootstrap.min.css
157157}
158158
159−grunt_build() {
160− npm_path_setup
161−
162− echo '[!] Grunt build : oscar theme'
163− grunt --gruntfile "$SEARX_DIR/static/themes/oscar/gruntfile.js"
164− echo '[!] Grunt build : simple theme'
165− grunt --gruntfile "$SEARX_DIR/static/themes/simple/gruntfile.js"
166−}
167−
168159docker_build() {
169160 # Check if it is a git repository
170161 if [ ! -d .git ]; then
@@ -257,7 +248,6 @@ Commands
257248 -----
258249 locales - Compile locales
259250 styles - Build less files
260− grunt_build - Build files for themes
261251 docker_build - Build Docker image
262252
263253 Tests
searx/static/themes/oscar/gruntfile.js+1−3
@@ -13,7 +13,7 @@ module.exports = function(grunt) {
1313 },
1414 uglify: {
1515 options: {
16− banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
16+ banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
1717 },
1818 dist: {
1919 files: {
@@ -38,7 +38,6 @@ module.exports = function(grunt) {
3838 development: {
3939 options: {
4040 paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"]
41− //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
4241 },
4342 files: {"css/pointhi.css": "less/pointhi/oscar.less",
4443 "css/logicodev.css": "less/logicodev-dark/oscar.less",
@@ -47,7 +46,6 @@ module.exports = function(grunt) {
4746 production: {
4847 options: {
4948 paths: ["less/pointhi", "less/logicodev", "less/logicodev-dark"],
50− //banner: '/*! less/oscar/oscar.css | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n',
5149 cleancss: true
5250 },
5351 files: {"css/pointhi.min.css": "less/pointhi/oscar.less",
searx/static/themes/simple/gruntfile.js+3−3
@@ -36,7 +36,7 @@ module.exports = function(grunt) {
3636 },
3737 uglify: {
3838 options: {
39− banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n',
39+ banner: '/*! simple/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n',
4040 output: {
4141 comments: 'some'
4242 },
@@ -57,7 +57,7 @@ module.exports = function(grunt) {
5757 development: {
5858 options: {
5959 paths: ["less"],
60− banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
60+ banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
6161 },
6262 files: {
6363 "css/searx.css": "less/style.less",
@@ -73,7 +73,7 @@ module.exports = function(grunt) {
7373 compatibility: '*'
7474 })
7575 ],
76− banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
76+ banner: '/*! searx | <%= grunt.template.today("dd-mm-yyyy") %> | <%= process.env.GIT_URL %> */\n'
7777 },
7878 files: {
7979 "css/searx.min.css": "less/style.less",