Git Product home page Git Product logo

gradle-hugo-plugin's Introduction

Gradle Hugo plugin

Build Gradle Plugin Portal

Minimal Java version Minimal Gradle version

Wrapper for Hugo static site generator.

The plugin provides a declarative approach for the Hugo binary used to build the static site.
The requested Hugo version is downloaded and cached by Gradle to ensure that your static site is built with the right version of Hugo.

Extension configuration

Plugin extension is available to override general configuration (default values provided below).

hugo {
    // Hugo version
    version = "0.127.0"
    // Relative path to sources of Hugo site in Gradle project
    sourceDirectory = "site"
    // Download URL for Windows ( {0} can be used to replace version )
    windowsDownloadUrl = "https://github.com/gohugoio/hugo/releases/download/v{0}/hugo_extended_{0}_windows-amd64.zip"
    // Download URL for Linux ( {0} can be used to replace version )
    linuxDownloadUrl = "https://github.com/gohugoio/hugo/releases/download/v{0}/hugo_extended_{0}_linux-amd64.tar.gz"
    // Download URL for macOS ( {0} can be used to replace version )
    macOSDownloadUrl = "https://github.com/gohugoio/hugo/releases/download/v{0}/hugo_extended_{0}_darwin-universal.tar.gz"
    // Operating system family (Windows, macOS or Unix)
    osFamily = io.github.fstaudt.hugo.OsFamily.CURRENT_SYSTEM // default value derived from system property "os.name"
}

Tasks

hugo

Execute any Hugo command (e.g. new, gen, check ...).

Option command allows to specify the Hugo command to execute.
It defaults to new site ..

gradle hugo --command=check

hugoServer

Run server for development of Hugo static site.

Task configuration can be overridden according to your needs (example values provided below).

tasks.hugoServer {
    // optional baseUrl to access Hugo static site in browser (defaults to baseUrl configured in config.toml)
    baseURL = "http://localhost:1313/documentation/"
    // optional additional server arguments (appended to arguments generated from baseUrl)
    args = "--buildDrafts --buildExpired"
}

๐Ÿ’ก This task is configurable in build.gradle.kts and should be preferred to hugo task to serve Hugo static site.

hugoBuild

Build Hugo static site for publication.

Task configuration can be overridden according to your needs (default values provided below).

tasks.hugoBuild {
    // Output directory for build result
    outputDirectory = File("$buildDir/hugo/publish")
    // additional path in output directory
    publicationPath = ""
    // optional additional build arguments (appended to "-d" argument generated from previous properties) 
    args = ""
}

๐Ÿ’ก This task is cacheable and should be preferred to hugo task to build Hugo static site.

hugoDownload

Download Hugo binary for the current OS (Windows, macOS or Linux).

By default, downloaded version is Hugo extended v0.117.0.
Downloaded version can be configured in Extension configuration.

This task is a dependency of the previous tasks.

Examples

gradle-hugo-plugin's People

Contributors

dependabot[bot] avatar eskatos avatar fstaudt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

biasb eskatos

gradle-hugo-plugin's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.