Skip to content

Instantly share code, notes, and snippets.

Forked from ysb33r/gist:0c534d165863628a07cc
Last active October 11, 2017 07:28
Show Gist options
  • Save ItGumby/d9903a8cc14b8611e842 to your computer and use it in GitHub Desktop.
Save ItGumby/d9903a8cc14b8611e842 to your computer and use it in GitHub Desktop.
gradle build file for presentations from asciidoctor and deck.js
// You will need the VFS plugin
buildscript {
repositories {
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.0'
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:0.5'
classpath 'commons-httpclient:commons-httpclient:3.1'
apply plugin: 'vfs' // NOTE: We still using old-style. From 0.6+ this will be org.ysb33r.vfs.
apply plugin: 'org.asciidoctor.gradle.asciidoctor'
ext {
downloadDir = new File(buildDir,'downloads')
templateDir = new File(downloadDir,'asciidoctor-backends')
deckjsDir = new File(downloadDir,'deck.js')
outDir = new File('docs')
// We create special download task to pull from github
task download << {
mkdir downloadDir
vfs {
cp "zip:!asciidoctor-backends-master",
templateDir, recursive:true, overwrite:true
cp "zip:!deck.js-master",
deckjsDir, recursive:true, overwrite:true
download.onlyIf { !deckjsDir.exists() || !templateDir.exists() }
// Asciidoctor task needs to know where deck.js template is located
asciidoctor {
sourceDir = new File('src/asciidoc')
outputDir = outDir
backends = ['deckjs']
options = [
template_dirs : ["${templateDir}/haml".toString()],
attributes : [
'imagesdir': 'images',
'source-highligher': 'coderay',
'backend': 'deckjs',
'deckjs_theme': 'web-2.0', // 'web-2.0' , 'swiss', 'neon'
'deckjs_transition': 'horizontal-slide', // 'fade', 'horizontal-slide' , 'vertical-slide'
'customcss': 'css/custom.css',
//'viewport': 'width=1000, user-scalable=yes',
'sectids!': '',
// Completed slide deck needs to have deck.js included
asciidoctor.dependsOn 'download'
asciidoctor.dependsOn 'copyDependencies'
task copyDependencies( type : Copy ) {
from (downloadDir) {
include 'deck.js/**'
from ('src') {
include 'images/**'
include 'css/**'
into outDir
task gitHubPages(type : Copy) {
from outDir
into projectDir
rename(/.*\.html/, 'index.html')
gitHubPages.dependsOn 'asciidoctor'
Copy link

ItGumby commented Sep 10, 2014

have made asciidoctor depend on the download task (which only runs if deck.js or asciidoctor-backends are missing)

Copy link

ItGumby commented Sep 11, 2014

added gitHubPages task to stage output in project root.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment