diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2023-08-06 16:39:00 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-08-06 19:37:12 +0200 |
commit | 64100db9045ec712afbd8fa1becee14f7109921c (patch) | |
tree | fc80dd5f2006c278abcc74c77c84c865579a9f10 /utils/lib_sxng_themes.sh | |
parent | 1d0abb7157a24fd2c43afe30a35527cba3d6967a (diff) | |
download | searxng-64100db9045ec712afbd8fa1becee14f7109921c.tar.gz searxng-64100db9045ec712afbd8fa1becee14f7109921c.zip |
[doc] improve documentation of make targets and ./manage script
BTW force modularization of the ./mange script into sub modules:
- utils/lib_sxng_data.sh
- utils/lib_sxng_node.sh
- utils/lib_sxng_static.sh
- utils/lib_sxng_test.sh
- utils/lib_sxng_themes.sh
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'utils/lib_sxng_themes.sh')
-rwxr-xr-x | utils/lib_sxng_themes.sh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/utils/lib_sxng_themes.sh b/utils/lib_sxng_themes.sh new file mode 100755 index 000000000..8d41b6480 --- /dev/null +++ b/utils/lib_sxng_themes.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: AGPL-3.0-or-later + +declare _Blue +declare _creset + +themes.help(){ + cat <<EOF +themes.: + all : build all themes + live : to get live builds of CSS & JS use 'LIVE_THEME=simple make run' + simple.: + build : build simple theme + test : test simple theme +EOF +} + +themes.all() { + ( set -e + pygments.less + node.env + themes.simple + ) + dump_return $? +} + +themes.live() { + local LIVE_THEME="${LIVE_THEME:-${1}}" + case "${LIVE_THEME}" in + simple) + theme="searx/static/themes/${LIVE_THEME}" + ;; + '') + die_caller 42 "missing theme argument" + ;; + *) + die_caller 42 "unknown theme '${LIVE_THEME}' // [simple]'" + ;; + esac + build_msg GRUNT "theme: $1 (live build)" + nodejs.ensure + cd "${theme}" + { + npm install + npm run watch + } 2>&1 \ + | prefix_stdout "${_Blue}THEME ${1} ${_creset} " \ + | grep -E --ignore-case --color 'error[s]?[:]? |warning[s]?[:]? |' +} + +themes.simple() { + ( set -e + build_msg GRUNT "theme: simple" + npm --prefix searx/static/themes/simple run build + ) + dump_return $? +} + +themes.simple.test() { + build_msg TEST "theme: simple" + nodejs.ensure + npm --prefix searx/static/themes/simple install + npm --prefix searx/static/themes/simple run test + dump_return $? +} |