]> git.immae.eu Git - github/bastienwirtz/homer.git/blame - docs/development.md
Prepped the rest of the documentation for launch
[github/bastienwirtz/homer.git] / docs / development.md
CommitLineData
1d3287dc 1# Development
1bc75494 2
2ca4faad
BW
3If you want to contribute to Homer, please read the [contributing guidelines](https://github.com/bastienwirtz/homer/blob/main/CONTRIBUTING.md) first.
4
1bc75494
BW
5```sh
6# Using yarn (recommended)
7yarn install
8yarn serve
9
10# **OR** Using npm
11npm install
12npm run serve
13```
14
2ca4faad
BW
15## Custom services
16
17Custom services are small VueJs component (see `src/components/services/`) that add little features to a classic, "static", dashboard item. It should be very simple.
18A dashboard can contain a lot of items, so performance is very important.
19
20The [`Generic`](https://github.com/bastienwirtz/homer/blob/main/src/components/services/Generic.vue) service provides a typical card layout which
21you can extend to add specific features. Unless you want a completely different design, extended the generic service is the recommended way. It gives you 3 [slots](https://vuejs.org/v2/guide/components-slots.html#Named-Slots) to extend: `icon`, `content` and `indicator`.
22Each one is **optional**, and will display the usual information if omitted.
23
24Each service must implement the `item` [property](https://vuejs.org/v2/guide/components-props.html) and bind it the Generic component if used.
25
26### Skeleton
27```Vue
28<template>
29 <Generic :item="item">
30 <template #icon>
31 <!-- left area containing the icon -->
32 </template>
33 <template #content>
34 <!-- main area containing the title, subtitle, ... -->
35 </template>
36 <template #indicator>
37 <!-- top right area, empty by default -->
38 </template>
39 </Generic>
40</template>
41
42<script>
43import Generic from "./Generic.vue";
44
45export default {
46 name: "MyNewService",
47 props: {
48 item: Object,
49 },
50 components: {
51 Generic,
52 }
53};
54</script>
55```
56
57
1d3287dc 58## Themes
1bc75494
BW
59
60Themes are meant to be simple customization (written in [scss](https://sass-lang.com/documentation/syntax)).
2662b170 61To add a new theme, just add a file in the theme directory, and put all style in the `body #app.theme-<name>` scope. Then import it in the main style file.
1bc75494
BW
62
63```scss
64// `src/assets/themes/my-awesome-theme.scss`
65body #app.theme-my-awesome-theme. { ... }
66```
67
68```scss
69// `src/assets/app.scss`
70// Themes import
71@import "./themes/sui.scss";
72...
73@import "./themes/my-awesome-theme.scss";
74```
1d6d20e7
ES
75
76
77## Documentation
78
79### Install Python dependencies
80
81Homer's documentation is built using
82[Material for MkDocs](https://squidfunk.github.io/mkdocs-material/). To get
83started, you'll need Python 3 installed on your machine and set up your local
84environment.
85
86```sh
87python -m venv venv
88source venv/bin/activate
89pip install -r requirements.txt
90```
91
92### Preview local copy
93
94MkDocs comes with a command-line utility for building and serving the static
95documentation site every time you save a file. To launch it, run the `serve`
96command.
97
98```sh
99mkdocs serve
100```
101
102Your local version of the docs site will now be available at
103http://localhost:8000/.