Skip to content

Commit df1a009

Browse files
docs(hugo): Add section on how to use the hugo binary (#6)
- Add section how to use the hugo binary - Add note on updating .gitignore file
1 parent 77f86b4 commit df1a009

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

README.md

+31-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ allows for the hugo version to be configured someplace else, e.g. in a `otherDep
7474

7575
### Configure binary path (optional)
7676

77-
The `--destination` CLI parameter can be used to define the folder into which the Hugo binary will be placed. For example:
77+
The `--destination` CLI parameter can be used to define the folder into which the Hugo binary will be placed. This parameter is optional,
78+
the default destination path is `bin/hugo`. For example:
7879

7980
``` json
8081
{
@@ -84,7 +85,35 @@ The `--destination` CLI parameter can be used to define the folder into which th
8485
}
8586
```
8687

87-
> This parameter is optional, the default destination path is `bin/hugo`.
88+
> Don't forget to add the destination path to your `.gitignore` file!
89+
90+
<br><br><br>
91+
92+
## Using the Hugo binary
93+
94+
Once fetched, the hugo binary can be used directly from your favourite command line. For example:
95+
96+
``` bash
97+
bin/hugo/hugo.exe --config=hugo.config.json
98+
```
99+
100+
Alternatively, one might also want to integrate Hugo in a NodeJS build script, or a NodeJS-based build tool such as
101+
**[Gulp](https://gulpjs.com/)**. You can execute the Hugo binary using the `spawn` command; for example:
102+
103+
``` javascript
104+
const path = require( 'path' );
105+
const spawn = require( 'child_process' ).spawn;
106+
107+
// Use Hugo
108+
spawn( path.resolve( process.cwd(), 'bin', 'hugo', 'hugo' ), [
109+
`--config=hugo.config.json`
110+
], {
111+
stdio: 'inherit'
112+
} )
113+
.on( 'close', () => {
114+
// Callback
115+
} );
116+
```
88117

89118
<br><br><br>
90119

0 commit comments

Comments
 (0)