Skip to content

Commit ecff385

Browse files
committed
Update existing docs and add new docs
* Updates docs about sass-watcher process in docker * Adds docs about hacking CSS * Adds docs on how to build CSS from Sass when building NAV from source
1 parent c3b23d1 commit ecff385

File tree

4 files changed

+42
-5
lines changed

4 files changed

+42
-5
lines changed

doc/hacking/hacking.rst

+19
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ Directory Description
156156
processes.
157157
:file:`python/` Python source code.
158158
:file:`python/nav/etc/` Example/initial configuration files.
159+
:file:`python/nav/web/sass/` SCSS stylesheets.
159160
:file:`python/nav/web/static/` Static media such as CSS stylesheets, images and JavaScript to be
160161
served by a webserver.
161162
:file:`python/nav/web/templates/` Main/global Django HTML templates. More be located in individual
@@ -283,6 +284,24 @@ developing, something browsers love to do! See `config-urlArgs
283284
documentation for details. :file:`require_config.dev.js` is listed in the
284285
repository :file:`.gitignore` file.
285286

287+
CSS
288+
---
289+
290+
NAV uses Sass for styling. If you want to modify the styling,
291+
you can do so by editing the SCSS files in the :file:`python/nav/web/static/scss`
292+
directory. To build the CSS assets, you will need to have Node.js
293+
and npm installed. Once you have these installed, you can run
294+
the following command to build the CSS files::
295+
296+
npm install
297+
npm run build:sass
298+
299+
This will build the CSS assets and place them in the :file:`python/nav/web/static/css`
300+
directory. If you want to watch for changes in the SCSS files and rebuild the
301+
CSS assets automatically, you can run the following command instead::
302+
303+
npm run watch:sass
304+
286305

287306

288307
Database

doc/hacking/using-docker.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,10 @@ nav
187187
starts.
188188

189189
sass-watcher
190-
This is a process that monitors the :file:`python/nav/web/sass/` subdirectory
191-
for changes, and re-runs ``python setup.py build_sass`` (i.e. rebuilding all
192-
the SASS-based stylesheets) on changes.
190+
This is a process that runs ``npm run watch:sass`` command to monitor and
191+
rebuild all the SASS-based stylesheets whenever changes occur
192+
in the :file:`python/nav/web/sass/` subdirectory. The command continuously
193+
monitors the files and does not exit by itself.
193194

194195
The individual logs of these program are typically found inside the ``nav``
195196
container in the :file:`/var/log/supervisor/` directory. The NAV process logs

doc/howto/generic-install-from-source.rst

+17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
This is a generic guide to installing NAV from source code on a \*NIX flavored
66
operating system. The specifics of how to install NAV's dependencies, such as
77
:xref:`PostgreSQL` or :xref:`Graphite` will be entirely up to you and your choice of OS.
8+
Note that building NAV from source will also require Node.js and npm to be installed
9+
in order to manage frontend assets.
810

911

1012
Dependencies
@@ -21,6 +23,11 @@ To build NAV, you need at least the following:
2123
* Python >= 3.9.0
2224
* Sphinx >= 1.0 (for building this documentation)
2325

26+
Additionally to build frontend assets (like CSS and JS), you will need:
27+
28+
* Node.js >= 14.0
29+
* npm >= 6.0
30+
2431
Runtime requirements
2532
--------------------
2633

@@ -73,6 +80,16 @@ default.
7380
Installing NAV
7481
==============
7582

83+
First you need to build the static assets. To do this, you will need to have
84+
Node.js and npm installed. Once you have these installed, you can run
85+
the following command to build the CSS assets::
86+
87+
npm install
88+
npm run build:sass
89+
90+
This will build the CSS assets and place them in the :file:`python/nav/web/static/css`
91+
directory.
92+
7693
To build and install NAV and all its Python dependencies::
7794

7895
pip install -r requirements.txt -c constraints.txt .

doc/intro/install.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
There are two main options for installing NAV: Either from source code, or from
88
a pre-packaged version. Some of these options will require manually installing
99
and/or configuring 3rd party software that NAV depends on, mainly :xref:`PostgreSQL`
10-
and :xref:`Graphite`.
10+
and :xref:`Graphite`. Building NAV from source code will also require Node.js
11+
and npm to be installed.
1112

1213

1314
Installing a pre-packaged version of NAV
@@ -96,4 +97,3 @@ For you, we provide two guides:
9697
</howto/generic-install-from-source>`.
9798
2. :doc:`A step-by-step, detailed guide on installing NAV from source on a
9899
Debian GNU/Linux operating system </howto/manual-install-on-debian>`.
99-

0 commit comments

Comments
 (0)