diff docs/usage/customization.rst @ 7437:b66725ba01ed

cli: add command 'kallithea-cli front-end-build' Kallithea is under the GPL license, and we can thus only distribute any generated code if we also ship the corresponding source. We are moving towards a web front-end that use npm to download and compile various open source components. The components might not be GPL, but if we distribute any parts of their code (compiled or converted to other representation), then we also must distribute the corresponding source under the GPL. It doesn't seem feasible for us to distribute the source of everything that npm downloads and includes when we are building. It thus also doesn't seem feasible for us to build and ship the compiled (possibly minified) front-end code. Instead, we have to make it as smooth as possible for our users to get up and running. It doesn't seem feasible for us to ship or install npm. We must assume it is available. That requirement must be documented clearly, and we must recommend how to install npm for the most common platforms. We could perhaps just document what manual steps to run. Kallithea doesn't work out of the box anyway - it has to be configured and initialized. Extra steps might not be a big problem. Another approach is to call out to npm while pip is installing Kallithea and download the requirements and build the files. It can be done by customizing setuptools commands in setup.py. But: Python packaging is fragile. Even though we only support pip, it really isn't built for things like this. Custom output is muted and buffered and only shown if running with -v or the command fails. And pip and setup.py can be used to build and install in so many ways that we probably can't make it work reliably with all ways of installing Kallithea. The approach implemented by this commit is to add a custom cli command 'front-end-build' to run the required commands. This single user-facing command can internally run various steps as needed. The only current requirement is the presence of npm and an internet connection. For now, this will just create/update style.css ... but currently probably without any actual changes. The files created by npm (and the node_modules directory) must *not* be a part of the release package made with 'setup.py sdist'. (Commit message is mostly written by Mads Kiilerich)
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Mon, 24 Sep 2018 20:44:36 +0200
parents f9c8fec48185
children 3b54bcf6d128
line wrap: on
line diff
--- a/docs/usage/customization.rst	Thu Nov 22 21:51:52 2018 +0100
+++ b/docs/usage/customization.rst	Mon Sep 24 20:44:36 2018 +0200
@@ -28,13 +28,10 @@
 you can use this to override ``@kallithea-theme-main-color``,
 ``@kallithea-logo-url`` or other `Bootstrap variables`_.
 
-After creating the ``theme.less`` file, you need to regenerate the CSS files.
-Install npm for your platform and run::
+After creating the ``theme.less`` file, you need to regenerate the CSS files, by
+running::
 
-    npm install
-    npm run less
-
-in the Kallithea root directory.
+    kallithea-cli front-end-build --no-install-deps
 
 .. _bootstrap 3: https://getbootstrap.com/docs/3.3/
 .. _bootstrap variables: https://getbootstrap.com/docs/3.3/customize/#less-variables