Skip to content

Commit

Permalink
docs(hugo): Add section on how to use the hugo binary (#6)
Browse files Browse the repository at this point in the history
- Add section how to use the hugo binary
- Add note on updating .gitignore file
  • Loading branch information
dominique-mueller authored Aug 12, 2018
1 parent 77f86b4 commit df1a009
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ allows for the hugo version to be configured someplace else, e.g. in a `otherDep

### Configure binary path (optional)

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

``` json
{
Expand All @@ -84,7 +85,35 @@ The `--destination` CLI parameter can be used to define the folder into which th
}
```

> This parameter is optional, the default destination path is `bin/hugo`.
> Don't forget to add the destination path to your `.gitignore` file!
<br><br><br>

## Using the Hugo binary

Once fetched, the hugo binary can be used directly from your favourite command line. For example:

``` bash
bin/hugo/hugo.exe --config=hugo.config.json
```

Alternatively, one might also want to integrate Hugo in a NodeJS build script, or a NodeJS-based build tool such as
**[Gulp](https://gulpjs.com/)**. You can execute the Hugo binary using the `spawn` command; for example:

``` javascript
const path = require( 'path' );
const spawn = require( 'child_process' ).spawn;

// Use Hugo
spawn( path.resolve( process.cwd(), 'bin', 'hugo', 'hugo' ), [
`--config=hugo.config.json`
], {
stdio: 'inherit'
} )
.on( 'close', () => {
// Callback
} );
```

<br><br><br>

Expand Down

0 comments on commit df1a009

Please sign in to comment.