1
mirror of https://github.com/jakejarvis/hugo-extended.git synced 2025-04-26 14:38:28 -04:00
2023-06-23 16:17:32 +03:00
2023-05-25 08:58:33 +03:00
2023-05-17 08:31:53 +03:00
2023-06-05 14:22:41 +03:00
2023-05-31 09:17:34 +03:00
2023-05-25 08:58:33 +03:00
2016-05-31 02:44:50 +09:00
2020-09-15 10:57:05 +03:00
2023-05-25 08:58:33 +03:00
2023-03-03 07:06:45 +02:00
2023-05-17 08:31:53 +03:00
2016-05-31 02:44:50 +09:00
2023-06-23 16:17:32 +03:00
2023-06-23 16:17:32 +03:00
2023-05-17 08:31:53 +03:00

hugo-bin npm version Build Status

Binary wrapper for Hugo

  • hugo-bin supports the Extended Hugo version
  • For usage within corporate networks or behind corporate proxies, the download repository can be overwritten

See Installation options for more details.

Install

npm install hugo-bin --save-dev

Usage

API

import { execFile } from 'node:child_process';
import hugoPath from 'hugo-bin';

execFile(hugoPath, ['version'], (error, stdout) => {
  if (error) {
    throw error;
  }

  console.log(stdout);
});

CLI

Unix

# older npm
$(npm bin)/hugo --help
# newer npm (v9+)
npm exec hugo help
npm run create -- post/my-new-post.md # see below 'npm run-script'

Windows

rem older npm
for /f "delims=" %F in ('npm bin') do call "%F\hugo" help
rem newer npm (v9+)
npm exec hugo help
rem see below 'npm run-script'
npm run create -- post/my-new-post.md

npm run-script

{
  "scripts": {
    "build": "hugo",
    "create": "hugo new",
    "serve": "hugo server"
  }
}

See the Hugo Documentation for more information.

Installation options

hugo-bin supports options to change the variation of Hugo binaries and to overwrite the download repository.

Each option can be configured in one of the following ways:

The hugo-bin section of your package.json

{
  "name": "your-package",
  "version": "0.0.1",
  "hugo-bin": {
    "buildTags": "extended",
    "downloadRepo": "https://some.example.com/artifactory/github-releases"
  }
}

As local or global .npmrc configuration file

hugo_bin_build_tags = "extended"
hugo_bin_download_repo = "https://some.example.com/artifactory/github-releases"

As environment variables

export HUGO_BIN_BUILD_TAGS="extended"
export HUGO_BIN_DOWNLOAD_REPO="https://some.example.com/artifactory/github-releases"

Note that you have to run npm install hugo-bin to re-install hugo-bin itself, if you change any of these options.

Options

buildTags

Default: ""

Set buildTags to extended to download the extended version binary.

If this is set to extended but it's not available for the user's platform, then the normal version will be downloaded instead.

downloadRepo

Default: "https://github.com"

Set it to your proxy URL to download the hugo binary from a different download repository.

Supported Hugo versions

See the package.json commit history.

Super Inspired By

License

MIT © Shun Sato

Description
Plug-and-play Node.js wrapper for Hugo Extended, the awesomest static-site generator. ✏️
https://www.npmjs.com/package/hugo-extended Readme 3.4 MiB
Languages
JavaScript 100%