Fix README.frontend.md

This commit is contained in:
Lorenzo Vannucci 2023-03-29 17:30:24 +02:00
parent 58d8c21e1c
commit a27ab83307

View file

@ -1,6 +1,26 @@
# Frontend Development (Javascript/Vue/CSS)
ntopng is currently using npm to compile the frontend code (JS/CSS) under httpdocs/dist
The client side of the ntopng frontend is based on html/javascript/css/vue. Part of this (old style) is generated by Lua script. Instead new pages are written in modern html/javascript/css/vue and must be compiled.
Ntopng is currently using npm to compile the frontend code (JS/CSS) under httpdocs/dist.
Foreach file modified in http_src you must recompile httpdocs/dist.
## Requirements
To compile the new modern frontend part written in http_src you must have nodejs >= 18.15.0.
To install nodejs on Ubuntu run these command:
```
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&\
sudo apt-get install -y nodejs
```
On others Linux distributions to install nodeJs you can:
- download nodejs from https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.xz
- decomprime nodejs tar with:
```
tar -xvf node-v18.15.0-linux-x64.tar.xz
```
- export path of node-v18.15.0-linux-x64/bin:
```
export PATH=$PATH:$(pwd)/node-v18.15.0-linux-x64/bin
```
## Quick Start
@ -11,13 +31,13 @@ npm install
```
In order to automatically recompile the code (debug mode) whenever a change to the
frontend source files has been detected:
frontend source files under http_src/ has been detected:
```
npm run watch
npm run watch
```
In order to compile for production (ntopngjs bundle only):
In order to compile frontend source files under http_src/ for production (ntopngjs bundle only):
```
npm run build:ntopngjs
@ -28,4 +48,3 @@ In order to compile for production (also third party code):
```
npm run build
```