@@ -5,8 +5,6 @@ BASE_DIR="$(dirname -- "`readlink -f -- "$0"`")"
55cd -- "$BASE_DIR"
66set -e
77
8−export PATH="$(npm bin)":$PATH
9−
108# subshell
119PYTHONPATH="$BASE_DIR"
1210SEARX_DIR="$BASE_DIR/searx"
@@ -111,7 +109,14 @@ tests() {
111109# Web
112110#
113111
112+npm_path_setup() {
113+ which npm || (printf 'Error: npm is not found\n'; exit 1)
114+ export PATH="$(npm bin)":$PATH
115+}
116+
114117npm_packages() {
118+ npm_path_setup
119+
115120 echo '[!] install NPM packages'
116121 cd -- "$BASE_DIR"
117122 npm install less@2.7 less-plugin-clean-css grunt-cli
@@ -126,10 +131,14 @@ npm_packages() {
126131}
127132
128133build_style() {
134+ npm_path_setup
135+
129136 lessc --clean-css="--s1 --advanced --compatibility=ie9" "$BASE_DIR/searx/static/$1" "$BASE_DIR/searx/static/$2"
130137}
131138
132139styles() {
140+ npm_path_setup
141+
133142 echo '[!] Building legacy style'
134143 build_style themes/legacy/less/style.less themes/legacy/css/style.css
135144 build_style themes/legacy/less/style-rtl.less themes/legacy/css/style-rtl.css