• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jbake-org/jbake-gradle-plugin: A Gradle plugin for JBake

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jbake-org/jbake-gradle-plugin

开源软件地址(OpenSource Url):

https://github.com/jbake-org/jbake-gradle-plugin

开源编程语言(OpenSource Language):

Groovy 61.3%

开源软件介绍(OpenSource Introduction):

JBake plugin for Gradle

Build Status Coverage Status Apache License 2 Gradle Plugin Portal, link=


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

Requirements

  • Java 8

  • Gradle 6+

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.5.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.6.5'
}

The default is 2.6.7.

Render Engine configuration

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

jbake {
    pegdownVersion = '1.6.0'
    flexmarkVersion = '0.62.2' // since jbake 2.6.0
    freemarkerVersion = '2.3.31'
    groovyTemplatesVersion = '3.0.7'
    jade4jVersion = '1.2.7'
    thymeleafVersion = '3.0.12.RELEASE'
    pebbleVersion = '3.1.5' // since jbake 2.6.5
    asciidoctorJavaIntegrationVersion = '0.1.4' //pre jbake 2.3.1
    asciidoctorjVersion = '2.4.3' //since jbake 2.3.1
    jettyVersion = '9.4.36.v20210114'
}

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'
}



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Saloed/gradle-task发布时间:2022-06-14
下一篇:
turntabl/gradle-travis-sample发布时间:2022-06-14
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap