1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# Starter Theme for [Hugo](http://gohugo.io/)
## Installation
For example, if your Hugo website is in the `www` folder.
```
cd www
git init
git submodule add https://github.com/jimfrenette/hugo-starter.git themes/starter
```
## Dev Hugo Templates
```
cd www
hugo server -D
```
Preview the site, e.g., [`localhost:1313`](http://localhost:1313/)
## Generate Site
Prior to using the [webpack-plugin-serve](https://github.com/shellscape/webpack-plugin-serve) dev server, generate the site with `hugo`
```
cd www
hugo
```
## Webpack Dev UI
Install node modules
```
cd www/themes/starter
npm i
```
By default, the generated html files are ouput into the `./public` folder. e.g., `www/public`. If you have customized the output directory in the site config `publishDir` property, update the respective `webpack/dev.config.js` webpack-plugin-serve static path. e.g.,
```
const { WebpackPluginServe: Serve } = require('webpack-plugin-serve');
const serve = new Serve({
host: 'localhost',
static: ['../../public/'],
open: true,
liveReload: true
});
```
When you’re ready to develop your theme CSS and JavaScript, run the npm run dev command. This will launch the webpack development server, with watch enabled to build the css and javascrpt as changes are saved to the src. Live reload is also enabled so the changes are immediately rendered in the web browser.
```
cd www/themes/starter
npm run dev
```
Build for production with npm run build. CSS and JavaScript files will be output into the starter themes dist folder. e.g.,
```
cd www/themes/starter
npm run build
```
## Comments
To enable DISQUS comments, add `disqusShortname = YOURSHORTNAME` to your config file.
## Production
To run in production (e.g. to have Google Analytics show up), run `HUGO_ENV=production` before your build command. For example:
```
HUGO_ENV=production hugo
```
|