Skip to content

Instantly share code, notes, and snippets.

@ItGumby
Forked from ysb33r/gist:0c534d165863628a07cc
Last active October 11, 2017 07:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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 {
jcenter()
}
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:https://github.com/asciidoctor/asciidoctor-backends/archive/master.zip!asciidoctor-backends-master",
templateDir, recursive:true, overwrite:true
cp "zip:https://github.com/imakewebthings/deck.js/archive/master.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'
'navigation':'',
'goto':'',
'menu':'',
'status':'',
'blank':'',
'icons':'font',
'customcss': 'css/custom.css',
//'viewport': 'width=1000, user-scalable=yes',
'sectids!': '',
'showtitle':''
]
]
}
// 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'
@ItGumby
Copy link
Author

ItGumby commented Sep 10, 2014

updated to asciidoctor v1.5.0 and fixed a typo.

@ItGumby
Copy link
Author

ItGumby commented Sep 10, 2014

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

@ItGumby
Copy link
Author

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