Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.adoc

JBake plugin for Gradle

Build Status Coverage Status Apache License 2 download


This plugin allows rendering a site using JBake directly from Gradle.

Requirements

  • Java 8

  • Gradle 5+

Examples

A few of the sites that use the plugin and serve as a good example are:

Usage

This is work in progress

plugins {
    id 'org.jbake.site' version '5.3.0'
}

This will add a bake task to your build, which will search for a standard JBake source tree in src/jbake and generate content into $buildDir/jbake (typically build/jbake).

Warning
versions prior to 1.0.0 had a task named jbake. This task has been renamed to bake since 1.0.0.

Init

You can initialise the project structure by running the following command:

gradle bakeInit

The default template is set to groovy. You may change this setting by updating the template property of the jbake configuration. Accepted values are freemarker, groovy, groovy-mte, thymeleaf`, jade.

Alternatively you may define a value for templateUrl that points to a custom template, for example

bakeInit {
    templateUrl = 'http://server.acme.com/path/to/template.zip'
}

Previewing

You can preview your content by running the following command:

gradle bake bakePreview

This will start up a jetty container and serve your baked site on http://localhost:8080 by default. You can change the port by adding this to your build file.

bakePreview {
    port = '8090'
}

The bakePreview task is configured to server the output of the bake task. Should you need to render a different set of files then specify a value for the input property, like so

bakePreview {
    input = project.file('path/to/content')
}

Configuration

Plugin configuration

The default input and output directories can be changed using the jbake configuration block:

jbake {
    srcDirName  = 'jbake-sources'
    destDirName = 'output'
}

The generated output can then be found at $buildDir/output.

The Version could be changed too:

jbake {
    version  = '2.3.0'
}

The default is 2.6.5.

Render Engine configuration

Jbake uses several engines. The library versions could be changed too:

jbake {
    pegdownVersion = '1.6.0'
    flexmarkVersion = '0.61.0'
    freemarkerVersion = '2.3.30'
    groovyTemplatesVersion = '3.0.2'
    jade4jVersion = '1.2.7'
    thymeleafVersion = '3.0.11.RELEASE'
    asciidoctorJavaIntegrationVersion = '0.1.4'
    asciidoctorjVersion = '2.2.0'
    jettyVersion = '9.4.30.v20200611'
}

Notice the asciidoctorJavaIntegrationVersion and asciidoctorjVersion. Since Version 2.3.1 jbake has changed to the asciidoctorj library.

This plugin handles this change internally. If you use a Version > 2.3.0 of jbake, the dependency switch to the new one.

Since Version 2.6.0 jbake uses flexmark as replacement for pegdown.

JBake configuration

There are several options to configure JBake. One is to have the regular jbake.properties file into the source directory. The other is to use the plugin configuration block:

jbake {
   configuration['template.post.file'] = 'mypost.ftl'
}
You can’t perform that action at this time.