Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
Closes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrodriguez committed Jan 28, 2017
2 parents 8f5b0e0 + 7cff785 commit 57b3f08
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ $ mkdir -p assets/{img,styles,scripts}
$ hugulp build
```

It will use hugo's default config file: config.toml, but you can specify a
different config via the -c, --config switch

```bash
$ hugulp build --config config.yaml
```

Or

```bash
$ hugulp watch --config config.yaml
```


## Available Commands

### hugulp watch
Expand All @@ -60,7 +74,7 @@ It will do the following:

hugo will be invoked like this:
```bash
$ hugo --config=config.yaml -s . -d ./public --buildDrafts=true --verbose=true --baseUrl="http://localhost:3000/"
$ hugo --config=config.toml -s . -d ./public --buildDrafts=true --verbose=true --baseUrl="http://localhost:3000/"
```

- Change all references to the assets in your content files (index.html, etc.)
Expand All @@ -71,7 +85,7 @@ It runs the same pipeline as the hugulp build command, but hugo is invoked as
follows:

```bash
$ hugo --config=config.yaml -s . -d ./public"
$ hugo --config=config.toml -s . -d ./public"
```
Additionally, files are not watched for changes
Expand Down
14 changes: 13 additions & 1 deletion gulp/hugo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ function hugo(drafts) {

gutil.log('src: ' + src + ' dst: ' + dst);

var cmd = 'hugo --config=config.yaml -s ' + src + ' -d ' + dst;
var conf = 'config.toml'
var opt, i = process.argv.indexOf("--config");
if (i > -1) {
conf = process.argv[i+1];
} else {
opt, i = process.argv.indexOf("-c");
if (i > -1) {
conf = process.argv[i+1];
}
}
// console.log('conf %s', conf)

var cmd = 'hugo --config=' + conf + ' -s ' + src + ' -d ' + dst;
if (drafts) {
cmd += ' --buildDrafts=true --verbose=true --baseUrl="http://localhost:3000/" ';
}
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ function watch() {

program
.command('build')
.option('-c, --config [value]', 'Define an alternative config')
.description('build site (for publishing purposes)')
.action(bundle)

program
.command('watch')
.option('-c, --config [value]', 'Define an alternative config')
.description('build site and watch for changes')
.action(watch)

Expand Down

0 comments on commit 57b3f08

Please sign in to comment.