mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-04 10:29:34 +00:00
Add notes about frontend development
This commit is contained in:
parent
211499a7e6
commit
b160972e9e
22
README.md
22
README.md
@ -98,6 +98,28 @@ can also support activity by donating via
|
||||
|
||||
Thank you so much!
|
||||
|
||||
## Tech Stack
|
||||
|
||||
**Backend**
|
||||
|
||||
The servers is written in Scala in a pure functional style, based on
|
||||
libraries from the [typelevel](https://typelevel.org) stack: Cats,
|
||||
FS2, Doobie, Http4s, Circe and Pureconfig.
|
||||
|
||||
There are more libraries and technologies used, of course. Docspell is
|
||||
only a orchestration of great tools and libs. One important is the
|
||||
[Stanford-NLP](https://nlp.stanford.edu/software/), that provides the
|
||||
ML features. Furthermore, file processing relies on external tools
|
||||
like tesseract, unoconv and ocrmypdf. All dependencies can be looked
|
||||
up in `project/Dependencies.scala`.
|
||||
|
||||
|
||||
**Frontend**
|
||||
|
||||
The web frontend is a SPA written in [Elm](https://elm-lang.org). The
|
||||
UI framework in use is [tailwind](https://tailwindcss.com).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Docspell is free software, distributed under the [GPLv3 or
|
||||
|
@ -63,6 +63,45 @@ docspell.joex {
|
||||
}
|
||||
```
|
||||
|
||||
# Developing Frontend
|
||||
|
||||
The frontend is a SPA written in [Elm](https://elm-lang.org). The UI
|
||||
framework in use is [tailwind](https://tailwindcss.com).
|
||||
|
||||
The frontend code is in the sub-project `webapp`. Running sbt's
|
||||
`compile` task, compiles elm sources and creates the final CSS file.
|
||||
Whenever the `restserver` module is build by sbt, the `webapp`
|
||||
sub-project is built as well and the final files to deliver are
|
||||
updated. So, when in sbt shell, "watch-compile" the project
|
||||
`restserver`, (via `~ restserver/compile`), re-compiles elm-code on
|
||||
change. However, it also re-creates the final css, which is a rather
|
||||
long task.
|
||||
|
||||
To speed things up when only developing the frontend, a bash script is
|
||||
provided in `project/dev-ui-build.sh`. Start the `restserver` once,
|
||||
using `restserver/reStart` task as described above. Then run this
|
||||
script in the source root. It will watch elm files and the css file
|
||||
and re-compiles only on change writing the resulting files in the
|
||||
correct locations so they get picked up by the restserver.
|
||||
|
||||
Now you can edit elm files and the `index.css` and then only refresh
|
||||
the page. Elm compilation is *very* fast, it's difficult to reach the
|
||||
refresh button before it is done compiling :). When editing the CSS,
|
||||
it takes a little longer, but this is hardly necessary, thanks to
|
||||
tailwind.
|
||||
|
||||
There is still a problem: the browser caches the js and css files by
|
||||
default, so a page refresh is not enough, you need to clear the cache,
|
||||
too. To avoid this annoyance, set a env variable `DOCSPELL_ENV` to the
|
||||
value `dev`. Docspell then adds a response header, preventing the
|
||||
browser to cache these files. This must be done, obviously, before
|
||||
starting the restserver:
|
||||
|
||||
``` bash
|
||||
$ export DOCSPELL_ENV=dev
|
||||
$ sbt "restserver/reStart"
|
||||
```
|
||||
|
||||
# Nix Expressions
|
||||
|
||||
The directory `/nix` contains nix expressions to install docspell via
|
||||
|
Loading…
x
Reference in New Issue
Block a user