Skip to content

Commit

Permalink
[Enancement] - Simplify local builds to lower bar for beginners
Browse files Browse the repository at this point in the history
  • Loading branch information
pgfeller committed Jan 27, 2024
1 parent 9bd0799 commit b259221
Show file tree
Hide file tree
Showing 9 changed files with 19,984 additions and 2,663 deletions.
1 change: 1 addition & 0 deletions .vuepress/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
addons-*
public/logos
tmp
dist
94 changes: 0 additions & 94 deletions .vuepress/config.js

This file was deleted.

56 changes: 56 additions & 0 deletions .vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { DefaultThemeConfig, UserConfig, defineConfig } from "vuepress/config";

const DocsSidebarNavigation = require('./docs-sidebar.js')

const base = process.env.OH_DOCS_VERSION
? `/v${process.env.OH_DOCS_VERSION}/`
: '/'

const config: UserConfig<DefaultThemeConfig> = {
title: 'v4 Documentation Preview',
description: 'This is a preview of the main parts of the documentation, found in the openhab/openhab-docs repository',
dest: 'vuepress',
host: 'localhost',
plugins: [
// @ts-ignore
'tabs',
'container'
],
// @ts-ignore
base: base,
patterns: [
'docs/**/*.md',
'addons/integrations/**/*.md',
'**/*.vue'],
head: [
['link', { rel: 'stylesheet', href: `/fonts/fonts.css` }],
['link', { rel: 'icon', href: `/favicon.ico` }],
['link', { rel: 'shortcut icon', href: `/favicon.ico` }],
['link', { rel: 'apple-touch-icon', href: `/apple-icon.png` }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:image', content: 'https://www.openhab.org/og-image.png' }],

],
themeConfig: {
logo: `/openhab-logo.png`,
editLinks: false,
activeHeaderLinks: false,
sidebarDepth: 0,
docsDir: 'docs',
nav: [
{
text: 'Documentation',
link: '/docs/',
},
{
text: 'GitHub',
link: 'https://github.com/openhab/openhab-docs',
}
],
sidebar: {
'/docs/': DocsSidebarNavigation
}
}
};

export default defineConfig(config);
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,34 @@ When one of these jobs is finished, it will then notify our website hosting serv
This is recognized due to new commits in the final branch of this repository.
The new build will include all the latest changes in the code repository and in all external repositories.

### How to build the documentation locally

It is possible to build a preview version of the documentation on your local machine. The following software is required:

- [`node =16.20.1`](https://nodejs.org/en)
- [`ruby >=3.0.2`](https://www.ruby-lang.org/en/)
- [`Python >= 3.10.12`](https://www.python.org)

If you work on multiple node projects [Node Version Manager](https://github.com/nvm-sh/nvm) is recommended in case they use a different version of node.

Example:

```bash
$ nvm install 16
# ...
$ nvm use 16
Now using node v16.20.2 (npm v8.19.4)
$ npm run serve
# ...
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
```

The local preview is available at [http://0.0.0.0:8000/docs](http://0.0.0.0:8000/docs) :

![local preview](images/local-docu-preview.png)

This will also allow you to preview how the page renders on different devices using the respective browser tools.

## Documentation Versioning

Just as openHAB is released in versions, the documentation website provides fixed versions of the documentation articles, e.g., [https://www.openhab.org/v2.2/installation/linux.html](https://www.openhab.org/v2.2/installation/linux.html)
Expand Down
Binary file added images/local-docu-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b259221

Please sign in to comment.