Skip to content

Commit

Permalink
[mod] live build of a theme: LIVE_THEME=simple make run
Browse files Browse the repository at this point in the history
Environment variable to get live builds while modifying CSS & JS of a theme::

    LIVE_THEME=simple make run

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
  • Loading branch information
return42 committed Dec 29, 2021
1 parent 1706b13 commit c7f2740
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ help:

PHONY += run
run: install
$(Q) ( \
sleep 2 ; \
xdg-open http://127.0.0.1:8888/ ; \
) &
SEARXNG_DEBUG=1 ./manage pyenv.cmd python -m searx.webapp
$(Q)./manage webapp.run

PHONY += install uninstall
install uninstall:
Expand Down
19 changes: 12 additions & 7 deletions docs/dev/makefile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Makefile

To install system requirements follow :ref:`buildhosts`.

All relevant build tasks are implemented in :origin:`manage.sh` and for CI or
All relevant build tasks are implemented in :origin:`manage` and for CI or
IDE integration a small ``Makefile`` wrapper is available. If you are not
familiar with Makefiles, we recommend to read gnu-make_ introduction.

Expand Down Expand Up @@ -173,14 +173,19 @@ Install latest Node.js_ LTS locally (uses nvm_)::

To get up a running a developer instance simply call ``make run``. This enables
*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
instance, disables *debug* option again and opens the URL in your favorite WEB
browser (:man:`xdg-open`)::
instance and opens the URL in your favorite WEB browser (:man:`xdg-open`)::

$ make run
PYENV OK
SEARXNG_DEBUG=1 ./manage.sh pyenv.cmd python ./searx/webapp.py
...
INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)

Changes to theme's HTML templates (jinja2) are instant. Changes to the CSS & JS
sources of the theme need to be rebuild. You can do that by running::

$ make themes.all

Alternatively to ``themes.all`` you can run *live builds* of the theme you are
modify::

$ LIVE_THEME=simple make run

.. _make clean:

Expand Down
5 changes: 5 additions & 0 deletions docs/dev/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ JavaScript:
Alternatively you can also compile selective the theme you have modified,
e.g. the *simple* theme.

.. code:: sh
make themes.simple
.. tip::

To get live builds while modifying CSS & JS use: ``LIVE_THEME=simple make run``

If you finished your *tests* you can start to commit your changes. To separate
the modified source code from the build products first run:

Expand Down
11 changes: 11 additions & 0 deletions manage
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,17 @@ fi
# needed by sphinx-docs
export DOCS_BUILD

webapp.run() {
SEARXNG_DEBUG=1 pyenv.cmd python -m searx.webapp &
sleep 3
if [ "${LIVE_THEME}" ]; then
themes.live "${LIVE_THEME}" &
fi
xdg-open http://127.0.0.1:8888/
wait -n
kill 0
}

buildenv() {

# settings file from repository's working tree are used by default
Expand Down

0 comments on commit c7f2740

Please sign in to comment.