Updated README

This commit is contained in:
Lucien Cartier-Tilet 2020-06-23 11:14:53 +02:00
parent 659e406c5e
commit bffbd0c873
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
1 changed files with 26 additions and 43 deletions

View File

@ -46,58 +46,41 @@
that is also simple: it is the only one that provides a ~--watch~ option so
it automatically recompiles SCSS code to CSS when the SCSS code is changed.
** How to run this backend
** How to run this project
This backend delivers only two main files:
- =/dart/main.dart.js= The main dart file compiled to Javascript (you dont
need to worry about the others),
- =/style/style.css= The main style file compiled to CSS.
This is everything you need for beautiful org-generated websites.
*** Running locally
You could install Dart on your machine, as well as the Ruby implementation
of SASS with its dependencies. Next, you will need to install ~webdev~ and
install the Dart dependencies:
#+BEGIN_SRC sh
$ pub global activate webdev
$ pub get
#+END_SRC
While I tried to run this inside a Docker environment serving the Dart and
CSS files on a HTTP port to which I tried to redirect requests, I found the
easiest way was to actually compile everything into a ~build~ directory and
to simlink its content to the root directory of your org website like so:
#+BEGIN_SRC sh
cd /path/to/your/org/website
ln -s /path/to/your/owb/directory/*
#+END_SRC
By the way, you have to ensure your Dart caches bins are in your ~$PATH~.
They are generally installed in your ~$HOME/.pub-cache/bin~ directory.
Here is what I add at the top of my org files in order to get it working:
#+BEGIN_SRC org
,#+HTML_HEAD_EXTRA: <link rel="stylesheet" href="/style/style.css"/>
,#+HTML_HEAD_EXTRA: <script defer src="/dart/main.dart.js"></script>
#+END_SRC
In this order, it will make your website display stuff a bit faster.
Then, you have to run ~start.sh~, and youre good to go! Content will be
delivered on the 8080 port. If you wish to deliver content to another port,
you can edit this file.
#+BEGIN_SRC sh
./start.sh
#+END_SRC
To compile the project, you will need to install Dart on your machine as well
as a SCSS compiler. While the latter is up to you, make sur the result CSS
files are in the same directory as their original SCSS counterpart. As for
the Dart part of the project, you can run the following to create a release
build of the project:
#+BEGIN_SRC sh
pub global activate webdev
webdev build -r
#+END_SRC
*** Docker
A Dockerfile is also provided so you can run this server inside a Docker
container, and thus you can avoid the hassle of installing Dart and Ruby
Sass. In order to run OWB, you can first build the Docker image:
#+BEGIN_SRC sh
docker build . --tag owb:1.0
#+END_SRC
And then you can run it:
#+BEGIN_SRC sh
docker run \
-p 8080:8080 \
-v ./web:/app/web \
--restart always \
--detach \
--name owb \
owb:1.0
#+END_SRC
*** Docker-compose
This repository also provides a ~docker-compose.yml~ file for easier Docker
usage with ~docker-compose~. If you wish to run your backend in
release-mode, simply run the following:
#+BEGIN_SRC sh
docker-compose up --detach
#+END_SRC
If ~pub~ is not found as an executable, make sure ~$HOME/.pub-cache/bin~ is
in your ~$PATH~. Same goes for ~webdev~ even after you install it.
** Running in development mode
# To run this backend in development mode, you will have to remove the