All Projects → stackb → rules_hugo

stackb / rules_hugo

Licence: other
Bazel build rules for hugo static website generator

Programming Languages

Starlark
911 projects

Projects that are alternatives of or similar to rules hugo

yourfolio
⭐ Super simple and responsive theme for your personal website on Hugo
Stars: ✭ 28 (-31.71%)
Mutual labels:  hugo-theme
tools jvm autodeps
Automatic Dependency Management Tools for JVM Languages
Stars: ✭ 48 (+17.07%)
Mutual labels:  bazel
forty
Forty theme - Hugo theme ported from HTML5UP origrinal theme called Forty.
Stars: ✭ 116 (+182.93%)
Mutual labels:  hugo-theme
showfolio-hugo-theme
Modern portfolio theme for your Hugo site
Stars: ✭ 56 (+36.59%)
Mutual labels:  hugo-theme
real-world-bazel
The real world Angular example app moved to Bazel
Stars: ✭ 91 (+121.95%)
Mutual labels:  bazel
hugo-identity-theme
Little profile/card-style template for Hugo. Based on Identity by HTML5 UP.
Stars: ✭ 87 (+112.2%)
Mutual labels:  hugo-theme
capsule
A Hugo theme based on the CSS-only Bulma framework.
Stars: ✭ 20 (-51.22%)
Mutual labels:  hugo-theme
real-world-bazel
Bazel build files collected from real-world GitHub projects
Stars: ✭ 24 (-41.46%)
Mutual labels:  bazel
grab-bazel-common
Common rules and macros for Grab's Android projects built with Bazel.
Stars: ✭ 20 (-51.22%)
Mutual labels:  bazel
migration-tooling
Migration tools for Bazel
Stars: ✭ 40 (-2.44%)
Mutual labels:  bazel
influencer-hugo
Influencer is a Hugo theme for book authors and writers. It has also Snipcart supports for order books and payments.
Stars: ✭ 66 (+60.98%)
Mutual labels:  hugo-theme
geeky-hugo
Geeky is a Personal Hugo blog theme focused on high speed. Geeky is fully responsive, Superfast, and powered by Bootstrap v5.
Stars: ✭ 44 (+7.32%)
Mutual labels:  hugo-theme
cupper-hugo-theme
An accessibility-friendly Hugo theme, ported from the original Cupper project.
Stars: ✭ 233 (+468.29%)
Mutual labels:  hugo-theme
the-roots-home
I am not root, this is a hugo theme.
Stars: ✭ 29 (-29.27%)
Mutual labels:  hugo-theme
airin
A framework for automated migration of your projects to Bazel build system.
Stars: ✭ 21 (-48.78%)
Mutual labels:  bazel
hugo-xmag
A minimal magazine theme for Hugo
Stars: ✭ 62 (+51.22%)
Mutual labels:  hugo-theme
hugo-theme-docport
docport.netlify.app/
Stars: ✭ 42 (+2.44%)
Mutual labels:  hugo-theme
rules gwt
Bazel rules for GWT
Stars: ✭ 20 (-51.22%)
Mutual labels:  bazel
bazel-cache
Minimal cloud oriented Bazel gRPC cache
Stars: ✭ 33 (-19.51%)
Mutual labels:  bazel
hugo-theme-iris
Hugo IRIS Theme - Portfolio and Blog
Stars: ✭ 49 (+19.51%)
Mutual labels:  hugo-theme

rules_hugo

Build Status

Rules Hugo

Bazel rules for building static websites with Hugo.

Repository Rules

Name Description
hugo_repository Load hugo dependency for this repo.
github_hugo_theme Load a hugo theme from github.

Build Rules

Name Description
hugo_site Declare a hugo site.
hugo_theme Declare a hugo theme.

Usage

Add rules_hugo to your WORKSPACE and add a theme from github

# Update these to latest
RULES_HUGO_COMMIT = "..."
RULES_HUGO_SHA256 = "..."

http_archive(
    name = "build_stack_rules_hugo",
    url = "https://github.com/stackb/rules_hugo/archive/%s.zip" % RULES_HUGO_COMMIT,
    sha256 = RULES_HUGO_SHA256,
    strip_prefix = "rules_hugo-%s" % RULES_HUGO_COMMIT
)

load("@build_stack_rules_hugo//hugo:rules.bzl", "hugo_repository", "github_hugo_theme")

#
# Load hugo binary itself
#
# Optionally, load a specific version of Hugo, with the 'version' argument
hugo_repository(
    name = "hugo",
)

#
# This makes a filegroup target "@com_github_yihui_hugo_xmin//:files"
# available to your build files
#
github_hugo_theme(
    name = "com_github_yihui_hugo_xmin",
    owner = "yihui",
    repo = "hugo-xmin",
    commit = "c14ca049d0dd60386264ea68c91d8495809cc4c6",
)

Declare a hugo_site in your BUILD file

load("@build_stack_rules_hugo//hugo:rules.bzl", "hugo_site", "hugo_theme", "hugo_serve")

# Declare a theme 'xmin'.  In this case the `name` and
# `theme_name` are identical, so the `theme_name` could be omitted in this case.
hugo_theme(
    name = "xmin",
    theme_name = "xmin",
    srcs = [
        "@com_github_yihui_hugo_xmin//:files",
    ],
)

# Declare a site. Config file is required.
my_site_name = "basic"

hugo_site(
    name = my_site_name,
    config = "config.toml",
    content = [
        "_index.md",
        "about.md",
    ],
    quiet = False,
    theme = ":xmin",
)

# Run local development server
hugo_serve(
    name = "local_%s" % my_site_name,
    dep = [":%s" % my_site_name],
)

# Tar it up
pkg_tar(
    name = "%s_tar" % my_site_name,
    srcs = [":%s" % my_site_name],
)

Build the site

The hugo_site target emits the output in the bazel-bin directory.

$ bazel build :basic
[...]
Target //:basic up-to-date:
  bazel-bin/basic
[...]
$ tree bazel-bin/basic
bazel-bin/basic
├── 404.html
├── about
│   └── index.html
[...]

The pkg_tar target emits a %{name}_tar.tar file containing all the Hugo output files.

$ bazel build :basic_tar
[...]
Target //:basic up-to-date:
  bazel-bin/basic_tar.tar

End

See source code for details about additional rule attributes / parameters.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].