Rules Hugo
Categories:
Languages:
Statuses:
rules_hugo builds Hugo sites with a registered Hugo toolchain. It keeps the
site archive in the target configuration and the Hugo binary in the execution
configuration so site sources are not rebuilt for the execution platform.
al_hugo_site wraps a site source archive and its PostCSS tooling.
al_hugo_run_binary builds the site with the registered Hugo toolchain and
al_hugo_binary exposes a runnable Hugo command for a site. The optional
al_hugo_worker rule runs the build through a persistent worker.
Module setup
bazel_dep(name = "rules_hugo", version = "<VERSION>")
The Hugo toolchain is generated by the al_hugo_extension module
extension, not declared in @rules_hugo//pkg/bzl. Declare the extension
in the root module, request the toolchain archives for the Hugo version,
and register the generated toolchain repository:
al_hugo_extension = use_extension(
"@rules_hugo//pkg/bzl:al_hugo_extension.bzl",
"al_hugo_extension",
)
al_hugo_extension.toolchains(
name = "my_hugo_toolchain",
version = "0.165.0",
)
use_repo(
al_hugo_extension,
"my_hugo_toolchain_os_linux_cpu_x86_64",
)
register_toolchains("@my_hugo_toolchain_os_linux_cpu_x86_64")
The generated repository name is "<name>_<os>_<cpu>" for each platform
in the requested version’s archive set. See
projects/alwaldend.com/include.MODULE.bazel for a complete example that
also wires the Hugo lock file and remote themes.