← 全部工具

hugo-extended

热度 65 更新于 开发与构建

✏️ Plug-and-play binary wrapper for Hugo Extended, the awesomest static-site generator.

npmauto-collected

安装

npm
npm install -g hugo-extended

通过 npm 安装。

<img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/static/images/hugo-logo-wide.svg?sanitize=true" alt="Hugo" width="115" via NPM

Plug-and-play binary wrapper for Hugo Extended, the awesomest static-site generator. Now with full TypeScript support and type-safe APIs!

Features

  • 🚀 Zero configuration — Hugo binary is automatically downloaded on install
  • 📦 Version-locked — Package version matches Hugo version (e.g., hugo-extended@0.140.0 = Hugo v0.140.0)
  • 🔒 Type-safe API — Full TypeScript support with autocomplete for all Hugo commands and flags
  • ⚡ Multiple APIs — Use CLI, function-based, or builder-style APIs
  • 🎯 Extended by default — Automatically uses Hugo Extended on supported platforms

Installation

npm install hugo-extended --save-dev
# or
yarn add hugo-extended --dev
# or
pnpm add hugo-extended --save-dev

SCSS/PostCSS Support

If you're using Hugo's SCSS features, you'll also want:

npm install postcss postcss-cli autoprefixer --save-dev

These integrate seamlessly with Hugo's built-in PostCSS pipes.

Usage

CLI Usage

The simplest way — just run hugo commands directly:

// package.json
{
  "scripts": {
    "dev": "hugo server --buildDrafts",
    "build": "hugo --minify",
    "build:preview": "hugo --baseURL \"${DEPLOY_PRIME_URL:-/}\" --buildDrafts --buildFuture"
  }
}
npm run dev

Programmatic API

#### Builder-style API

A fluent interface where each Hugo command is a method: