Merge pull request #36 from MattSturgeon/hugo
Include hugo as a npm dependency
This commit is contained in:
commit
1b429572c8
|
@ -5,8 +5,6 @@ please read the [code of conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
> Install Hugo in your system: https://github.com/spf13/hugo/releases
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git clone https://github.com/netlify/victor-hugo
|
$ git clone https://github.com/netlify/victor-hugo
|
||||||
$ cd victor-hugo
|
$ cd victor-hugo
|
||||||
|
|
15
README.md
15
README.md
|
@ -11,15 +11,7 @@ This project is released under the [MIT license](LICENSE). Please make sure you
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Be sure that you have the latest node, npm and [Hugo](https://gohugo.io/) installed. If you need to install hugo on OSX, run:
|
Be sure that you have the latest node and npm installed.
|
||||||
|
|
||||||
```bash
|
|
||||||
brew install hugo
|
|
||||||
```
|
|
||||||
|
|
||||||
If you don't use OSX or don't use homebrew, follow the instructions for installation here instead:
|
|
||||||
|
|
||||||
http://gohugo.io/overview/installing/
|
|
||||||
|
|
||||||
Next, clone this repository and run:
|
Next, clone this repository and run:
|
||||||
|
|
||||||
|
@ -86,11 +78,6 @@ You can also click this button:
|
||||||
|
|
||||||
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/eliwilliamson/victor-hugo)
|
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/eliwilliamson/victor-hugo)
|
||||||
|
|
||||||
### Picking the right version of Hugo
|
|
||||||
|
|
||||||
Victor-Hugo doesn't make any assumption on which version of Hugo you use, this boilerplate works with any version above v0.13. However, the version
|
|
||||||
installed on your computer might not be the same version that Netlify uses to build your site. To ensure that those two versions match, open the `netlify.toml`
|
|
||||||
file and change the `HUGO_VERSION` variable to match the version you use in your computer. If you don't know which version you're using in your computer, you
|
|
||||||
can open a terminal and run `hugo version`, that will display the version in your computer.
|
|
||||||
|
|
||||||
## Enjoy!!
|
## Enjoy!!
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import gulp from "gulp";
|
import gulp from "gulp";
|
||||||
import cp from "child_process";
|
import { spawn } from "child_process";
|
||||||
|
import hugoBin from "hugo-bin"
|
||||||
import gutil from "gulp-util";
|
import gutil from "gulp-util";
|
||||||
import postcss from "gulp-postcss";
|
import postcss from "gulp-postcss";
|
||||||
import cssImport from "postcss-import";
|
import cssImport from "postcss-import";
|
||||||
|
@ -9,7 +10,6 @@ import webpack from "webpack";
|
||||||
import webpackConfig from "./webpack.conf";
|
import webpackConfig from "./webpack.conf";
|
||||||
|
|
||||||
const browserSync = BrowserSync.create();
|
const browserSync = BrowserSync.create();
|
||||||
const hugoBin = "hugo";
|
|
||||||
const defaultArgs = ["-d", "../dist", "-s", "site", "-v"];
|
const defaultArgs = ["-d", "../dist", "-s", "site", "-v"];
|
||||||
|
|
||||||
gulp.task("hugo", (cb) => buildSite(cb));
|
gulp.task("hugo", (cb) => buildSite(cb));
|
||||||
|
@ -53,7 +53,7 @@ gulp.task("server", ["hugo", "css", "js"], () => {
|
||||||
function buildSite(cb, options) {
|
function buildSite(cb, options) {
|
||||||
const args = options ? defaultArgs.concat(options) : defaultArgs;
|
const args = options ? defaultArgs.concat(options) : defaultArgs;
|
||||||
|
|
||||||
return cp.spawn(hugoBin, args, {stdio: "inherit"}).on("close", (code) => {
|
return spawn(hugoBin, args, {stdio: "inherit"}).on("close", (code) => {
|
||||||
if (code === 0) {
|
if (code === 0) {
|
||||||
browserSync.reload();
|
browserSync.reload();
|
||||||
cb();
|
cb();
|
||||||
|
|
|
@ -2,10 +2,5 @@
|
||||||
command = "npm run build"
|
command = "npm run build"
|
||||||
publish = "dist"
|
publish = "dist"
|
||||||
|
|
||||||
# Change the version of Hugo you want to use on Netlify
|
|
||||||
# by changing this environment variable.
|
|
||||||
[build.environment]
|
|
||||||
HUGO_VERSION = "v0.25.1"
|
|
||||||
|
|
||||||
[context.deploy-preview]
|
[context.deploy-preview]
|
||||||
command = "npm run build-preview"
|
command = "npm run build-preview"
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
"gulp-babel": "^6.1.2",
|
"gulp-babel": "^6.1.2",
|
||||||
"gulp-postcss": "^6.1.1",
|
"gulp-postcss": "^6.1.1",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-util": "^3.0.7",
|
||||||
|
"hugo-bin": "^0.12.0",
|
||||||
"imports-loader": "^0.7.1",
|
"imports-loader": "^0.7.1",
|
||||||
"postcss-cssnext": "^2.7.0",
|
"postcss-cssnext": "^2.7.0",
|
||||||
"postcss-import": "^10.0.0",
|
"postcss-import": "^10.0.0",
|
||||||
|
|
Reference in New Issue