diff --git a/.gitignore b/.gitignore
index ba2bfb2e..e21d4524 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,8 @@ app/assets/*.png
app/client/*.js*
app/launcher/*.js*
app/server/*
+app/docs/*
+!app/docs/.htaccess
!app/server/.keep
app/package.json
package-lock.json
diff --git a/package.json b/package.json
index 171eadae..7f24aea0 100644
--- a/package.json
+++ b/package.json
@@ -96,7 +96,7 @@
"watch-css": "nodemon --watch src/scss -e scss -x \"npm run build-css -- --reload\"",
"watch-server": "nodemon --watch src/server/ -e js -x \"npm run build-server-js\"",
"watch-launcher": "nodemon --watch src/launcher/ -e js -x \"npm run build-launcher-js\"",
- "build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && npm run build",
+ "build-docs": "node scripts/build-widgets-reference.js > resources/docs/docs/widgets/properties-reference.md && cd resources && mkdocs build",
"test": "eslint src && npm run build && node tests/test.js"
},
"engines": {
diff --git a/resources/.gitignore b/resources/.gitignore
deleted file mode 100644
index b86de750..00000000
--- a/resources/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-site/*
-!site/.htaccess
diff --git a/resources/README.md b/resources/README.md
index c7520065..ebcd94c9 100644
--- a/resources/README.md
+++ b/resources/README.md
@@ -1,9 +1,9 @@
# How to build the docs
```bash
-$ sudo apt-get install python python-pip # python package manager
-$ sudo pip install mkdocs # docs site builder
-$ sudo pip install mkdocs-material # theme
+# https://squidfunk.github.io/mkdocs-material/getting-started/
+$ python3 -m pip install mkdocs-material
+
$ mkdocs serve # make docs available on http://127.0.0.1:8000
# or
diff --git a/resources/docs/docs/getting-started/running-from-sources.md b/resources/docs/docs/getting-started/running-from-sources.md
index b02fb25d..8071bd0d 100644
--- a/resources/docs/docs/getting-started/running-from-sources.md
+++ b/resources/docs/docs/getting-started/running-from-sources.md
@@ -37,6 +37,17 @@ npm start [ -- options]
!!! info ""
A double hyphen (`--`) is used here to tell npm that the options are to be passed to the app.
+## Build documentation
+
+In order to make the local documentation available through the server's `--docs` option and the launcher's `Documentation` menu action, an extra step is needed.
+
+
+```bash
+# install docs website theme
+python3 -m pip install mkdocs-material
+# build docs website
+npm run build-docs
+```
## Package from sources
diff --git a/resources/docs/docs/getting-started/server-configuration.md b/resources/docs/docs/getting-started/server-configuration.md
index c3f5f402..dc12cb9b 100644
--- a/resources/docs/docs/getting-started/server-configuration.md
+++ b/resources/docs/docs/getting-started/server-configuration.md
@@ -138,6 +138,10 @@ The **server** can be configured with many options, either from a terminal or wi
Show help.
+ === "docs"
+
+ Serve documentation website locally and open it with the system\'s default browser
+
=== "version"
diff --git a/resources/docs/extra/styles.css b/resources/docs/extra/styles.css
index 4ee3e76a..aa202eb7 100644
--- a/resources/docs/extra/styles.css
+++ b/resources/docs/extra/styles.css
@@ -16,6 +16,10 @@ html {
padding-left: 0!important
}
+.md-source__facts {
+ display: none;
+}
+
td:first-child {
white-space: pre!important;
vertical-align: top;
diff --git a/resources/docs/img/icon-bolt.svg b/resources/docs/img/icon-bolt.svg
deleted file mode 120000
index c275e354..00000000
--- a/resources/docs/img/icon-bolt.svg
+++ /dev/null
@@ -1 +0,0 @@
-../../images/icons-bolt.svg
\ No newline at end of file
diff --git a/resources/images/icons-bolt.svg b/resources/images/icons-bolt.svg
deleted file mode 100644
index 68c34346..00000000
--- a/resources/images/icons-bolt.svg
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
diff --git a/resources/mkdocs.yml b/resources/mkdocs.yml
index d6ead9ef..1c466b4b 100644
--- a/resources/mkdocs.yml
+++ b/resources/mkdocs.yml
@@ -4,6 +4,7 @@ repo_url: https://github.com/jean-emmanuel/open-stage-control
edit_uri: tree/master/resources/docs/
copyright: "Copyleft © Jean-Emmanuel Doucet @ AMMD (GNU/GPLv3)"
site_description: "Libre and modular OSC / MIDI controller"
+site_dir: '../app/docs/'
theme:
name: 'material'
diff --git a/resources/overrides/main.html b/resources/overrides/main.html
index 52168ac5..ddd35433 100644
--- a/resources/overrides/main.html
+++ b/resources/overrides/main.html
@@ -5,4 +5,8 @@
+
{% endblock %}
diff --git a/resources/package.json b/resources/package.json
deleted file mode 100644
index e91675e4..00000000
--- a/resources/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "open-stage-control-docs",
- "version": "1.0.0",
- "description": "```bash $ sudo apt-get install python python-pip # python package manager $ sudo pip install mkdocs # docs site builder $ sudo pip install mkdocs-material # theme",
- "main": "index.js",
- "directories": {
- "doc": "docs"
- },
- "scripts": {
- "build": "mkdocs build"
- },
- "author": "Jean-Emmanuel Doucet",
- "license": "GPLv3"
-}
diff --git a/resources/scripts/build-css.js b/resources/scripts/build-css.js
deleted file mode 100644
index 1abe0a5f..00000000
--- a/resources/scripts/build-css.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var sass = require('node-sass'),
- path = require('path'),
- fs = require('fs')
-
-var result = sass.renderSync({
- file: path.resolve(__dirname + '/../src/scss/styles.scss'),
- outFile: path.resolve(__dirname + '/../theme/styles.css'),
- outputStyle: 'compressed',
- sourceMap: false
-})
-
-fs.writeFileSync(path.resolve(__dirname + '/../theme/styles.css'), result.css)
diff --git a/resources/site/.htaccess b/resources/site/.htaccess
deleted file mode 100644
index de377bfe..00000000
--- a/resources/site/.htaccess
+++ /dev/null
@@ -1 +0,0 @@
-ErrorDocument 404 /404.html
diff --git a/scripts/package.js b/scripts/package.js
index 64d68a8a..6fceea4c 100644
--- a/scripts/package.js
+++ b/scripts/package.js
@@ -18,7 +18,7 @@ packager({
overwrite: true,
out: path.resolve(__dirname + '/../dist'),
icon: path.resolve(__dirname + '/../resources/images/logo'),
- ignore: /node_modules\/(serialport|uws)/,
+ ignore: /(node_modules\/(serialport|uws)|docs\/fonts)/,
afterExtract: [safeFFMPEG],
prune: false
}).then((appPaths)=>{
diff --git a/src/server/docs-server.js b/src/server/docs-server.js
index 3ca235b6..66b75236 100644
--- a/src/server/docs-server.js
+++ b/src/server/docs-server.js
@@ -12,15 +12,14 @@ class DocsServer extends EventEmitter {
super(...arguments)
-
- this.baseUrl = path.resolve(__dirname + '/../../resources/site')
+ this.baseUrl = path.resolve(__dirname + '/../docs')
this.home = '/docs/getting-started/introduction/'
this.server = null
this.started = false
this.port = 0
this.available = true
- if (!fs.existsSync(this.baseUrl)) {
+ if (!fs.existsSync(path.join(this.baseUrl, 'index.html'))) {
console.error(`(ERROR, DOCS) Documentation assets not found in the app\'s directory.`)
this.available = false
}
@@ -68,9 +67,12 @@ class DocsServer extends EventEmitter {
if (url[url.length-1] === '/') url += 'index.html'
- var fpath = path.join(this.baseUrl, url)
+ if (url.indexOf('/fonts') === 0) url = '../assets' + url
- if (!fs.existsSync(fpath)) {
+ url = path.join(this.baseUrl, url)
+
+
+ if (!fs.existsSync(url)) {
if (url.indexOf('index.html') !== -1) {
return send(req, path.join(this.baseUrl, '/404.html')).pipe(res)
} else {
@@ -78,7 +80,7 @@ class DocsServer extends EventEmitter {
res.end()
}
} else {
- return send(req, fpath).pipe(res)
+ return send(req, url).pipe(res)
}
}