Slack chat Dokka docs Version gradle-plugin-portal Version maven-central

JEKYLL GRADLE PLUGIN

Gradle plugin providing easy configuration and tasks for managing your jekyll projects via gradle. Supports running via native jekyll installations as well as podman or docker container runtimes.

The plugin was last tested with JDK 11 & Gradle 7.3.3

Setup

plugins {
  id("dev.petuska.jekyll") version "<VERSION>"
}

When applied, the plugin automatically registers a single main jekyll sourceSet available at ./doc/main. To initialise it with a fresh jekyll project scaffold, run ./gradlew jekyllMainInit task.

If you are using Ruby version >3.0.0 or container mode, serve tasks may fail. You may fix it by adding webrick to your dependencies: ./gradlew bundleMainExec –arg=add –arg=webrick

From there, you can use ./gradlew jekyllMainServe --continuous to start development server and ./gradlew jekyllMainBuild to produce a static website at ./build/jekyll/main

Configuration

You can your own custom jekyll sourceSets or extend existing ones with additional sources via the jekyll extension.

DSL

jekyll {
  mode // Explicitly set default jekyll execution mode and stop it from being automatically detected.
  version // Set docker.io/jekyll/jekyll image version to use for containerised executions
  environment // Modify the default environment variables for jekyll tasks
  sourceSets {
    main {
      mode // Explicitly set default jekyll execution mode for tasks linked to this sourceSet and stop it from being automatically detected.
      version // Set docker.io/jekyll/jekyll image version to use for containerised executions  linked to this sourceSet
      environment // Modify the default environment variables for jekyll tasks linked to this sourceSet
      sources // Add additional source roots to this sourceSet
    }
  }
}

Tasks

The plugin generates the following gradle tasks for each sourceSet. All tasks wrap jekyll tasks with their options exposed as gradle options. To learn more run ./gradlew help --task=<task>

  • BundleExecTask: named as bundle<SourceSetName>Exec
  • JekyllExecTask: named as jekyll<SourceSetName>Exec
  • JekyllInitTask: named as jekyll<SourceSetName>Init
  • JekyllBuildTask: named as jekyll<SourceSetName>Build
  • JekyllServeTask: named as jekyll<SourceSetName>Serve

In addition to sourceSet tasks, two generic exec tasks are also provided for cli usage:

  • BundleExecTask: named as bundleExec
  • JekyllExecTask: named as jekyllExec

GitHub

View Github