cupper-hugo-theme/content/patterns/serving.md

35 lines
1.4 KiB
Markdown
Raw Normal View History

2017-06-27 21:15:38 +02:00
+++
title = "Serving"
2017-08-02 10:23:48 +02:00
weight = 3
2017-06-27 21:15:38 +02:00
+++
## Serving locally
2017-11-02 16:37:06 +01:00
While you're creating content for your project, you'll probably want to see what the finished product looks like. Fortunately, **Cupper** is easy to serve locally using the `serve` command:
2017-06-27 21:15:38 +02:00
{{<cmd>}}npm run serve{{</cmd>}}
2017-07-03 19:24:38 +02:00
2017-09-07 10:31:52 +02:00
This will serve your working project from `localhost:1313`. Whenever you make changes to your files, the site will automatically rebuild. No need to refresh the web page!
2017-07-03 19:24:38 +02:00
## Publishing on Github Pages
2017-11-02 16:37:06 +01:00
**Cupper** creates a `/docs` folder containing the latest version of your site whenever you do an `npm run build` or a `git commit`. So long as you forked the **Cupper** repository when making your own version (see {{% pattern "Setup" %}}), whenever you push to master, you will also be updating the site found at your Github Pages URL.
2017-07-03 21:02:40 +02:00
This URL will be in the following format:
```
2017-07-05 11:30:01 +02:00
[your user name].github.io/[your library repo name]
2017-07-03 21:02:40 +02:00
```
2017-11-02 16:37:06 +01:00
You'll also need to add this value to your `config.toml` file as the `baseURL`. For **Cupper**'s own documentation it looks like the following. Just overwrite it.
2017-08-08 10:32:40 +02:00
```
2017-11-02 16:37:06 +01:00
baseURL = "https://thepaciellogroup.github.io/cupper/"
2017-08-08 10:32:40 +02:00
```
2017-09-18 12:11:16 +02:00
### Set the publishing source
You will find the `docs` folder is not automatically setup as the publishing source, even when forking the repo. In which case, you must set it under **Settings → Github Pages → Source** in the web interface.
2017-08-08 10:32:40 +02:00
![The publishing source dropdown menu on Github](/images/serve_from_docs.png)